@@ -152,7 +152,11 @@ pub use crate::implement_godot_bounds;
152
152
// Memory bounds
153
153
154
154
/// Specifies the memory strategy of the static type.
155
- pub trait Memory : Sealed { }
155
+ pub trait Memory : Sealed {
156
+ /// True for everything inheriting `RefCounted`, false for `Object` and all other classes.
157
+ #[ doc( hidden) ]
158
+ const IS_REF_COUNTED : bool ;
159
+ }
156
160
157
161
/// Specifies the memory strategy of the dynamic type.
158
162
///
@@ -205,7 +209,9 @@ pub trait DynMemory: Sealed {
205
209
/// This is used for `RefCounted` classes and derived.
206
210
pub struct MemRefCounted { }
207
211
impl Sealed for MemRefCounted { }
208
- impl Memory for MemRefCounted { }
212
+ impl Memory for MemRefCounted {
213
+ const IS_REF_COUNTED : bool = true ;
214
+ }
209
215
impl DynMemory for MemRefCounted {
210
216
fn maybe_init_ref < T : GodotClass > ( obj : & mut RawGd < T > ) {
211
217
out ! ( " MemRefc::init: {obj:?}" ) ;
@@ -327,7 +333,9 @@ impl DynMemory for MemDynamic {
327
333
/// This is used for all `Object` derivates, which are not `RefCounted`. `Object` itself is also excluded.
328
334
pub struct MemManual { }
329
335
impl Sealed for MemManual { }
330
- impl Memory for MemManual { }
336
+ impl Memory for MemManual {
337
+ const IS_REF_COUNTED : bool = false ;
338
+ }
331
339
impl DynMemory for MemManual {
332
340
fn maybe_init_ref < T : GodotClass > ( _obj : & mut RawGd < T > ) { }
333
341
fn maybe_inc_ref < T : GodotClass > ( _obj : & mut RawGd < T > ) { }
0 commit comments