Skip to content

Commit 30a6dc5

Browse files
committed
Hide Bounds::DynMemory since it's not as useful currently
1 parent 9b39925 commit 30a6dc5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

godot-core/src/obj/bounds.rs

+18-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
//! Different ways how bounds of a `GodotClass` can be checked.
99
//!
10-
//! This module contains three traits that can be used to check the characteristics of a `GodotClass` type:
10+
//! This module contains multiple traits that can be used to check the characteristics of a `GodotClass` type:
1111
//!
1212
//! 1. [`Declarer`] tells you whether the class is provided by the engine or user-defined.
1313
//! - [`DeclEngine`] is used for all classes provided by the engine (e.g. `Node3D`).
@@ -19,15 +19,16 @@
1919
//! - [`MemRefCounted`] is used for `RefCounted` classes and derived.
2020
//! - [`MemManual`] is used for `Object` and all inherited classes, which are not `RefCounted` (e.g. `Node`).<br><br>
2121
//!
22-
//! 3. [`DynMemory`] is used to check the memory strategy of the **dynamic** type.
23-
//!
24-
//! When you operate on methods of `T` or `Gd<T>` and are interested in instances, you can use this.
25-
//! Most of the time, this is not what you want -- just use `Memory` if you want to know if a type is manually managed or ref-counted.
26-
//! - [`MemRefCounted`] is used for `RefCounted` classes and derived. These are **always** reference-counted.
27-
//! - [`MemManual`] is used instances inheriting `Object`, which are not `RefCounted` (e.g. `Node`). Excludes `Object` itself. These are
28-
//! **always** manually managed.
29-
//! - [`MemDynamic`] is used for `Object` instances. `Gd<Object>` can point to objects of any possible class, so whether we are dealing with
30-
//! a ref-counted or manually-managed object is determined only at runtime.
22+
// FIXME excluded because broken; see below.
23+
// 3. [`DynMemory`] is used to check the memory strategy of the **dynamic** type.
24+
//
25+
// When you operate on methods of `T` or `Gd<T>` and are interested in instances, you can use this.
26+
// Most of the time, this is not what you want -- just use `Memory` if you want to know if a type is manually managed or ref-counted.
27+
// - [`MemRefCounted`] is used for `RefCounted` classes and derived. These are **always** reference-counted.
28+
// - [`MemManual`] is used instances inheriting `Object`, which are not `RefCounted` (e.g. `Node`). Excludes `Object` itself. These are
29+
// **always** manually managed.
30+
// - [`MemDynamic`] is used for `Object` instances. `Gd<Object>` can point to objects of any possible class, so whether we are dealing with
31+
// a ref-counted or manually-managed object is determined only at runtime.
3132
//!
3233
//!
3334
//! # Example
@@ -44,7 +45,7 @@
4445
//! }
4546
//! ```
4647
//!
47-
//! Note that depending on if you want to exclude `Object`, you should use `DynMemory` instead of `Memory`.
48+
// Note that depending on if you want to exclude `Object`, you should use `DynMemory` instead of `Memory`.
4849

4950
use crate::obj::cap::GodotDefault;
5051
use crate::obj::{Bounds, Gd, GodotClass, RawGd};
@@ -86,6 +87,10 @@ pub(super) mod private {
8687
/// Defines the memory strategy of the static type.
8788
type Memory: Memory;
8889

90+
// FIXME: this is broken as a bound: one cannot use T: Bounds<DynMemory = MemRefCounted> to include Object AND RefCounted,
91+
// since Object itself has DynMemory = MemDynamic. Needs to either use traits like in gdnative, or more types to account for
92+
// different combinations (as only positive ones can be expressed, not T: Bounds<Memory != MemManual>).
93+
#[doc(hidden)]
8994
/// Defines the memory strategy of the instance (at runtime).
9095
type DynMemory: DynMemory;
9196

@@ -146,6 +151,7 @@ pub trait Memory: Sealed {}
146151
/// Specifies the memory strategy of the dynamic type.
147152
///
148153
/// For `Gd<Object>`, it is determined at runtime whether the instance is manually managed or ref-counted.
154+
#[doc(hidden)]
149155
pub trait DynMemory: Sealed {
150156
/// Initialize reference counter
151157
#[doc(hidden)]
@@ -254,6 +260,7 @@ impl DynMemory for MemRefCounted {
254260

255261
/// Memory managed through Godot reference counter, if present; otherwise manual.
256262
/// This is used only for `Object` classes.
263+
#[doc(hidden)]
257264
pub struct MemDynamic {}
258265
impl MemDynamic {
259266
/// Check whether dynamic type is ref-counted.

0 commit comments

Comments
 (0)