@@ -8,51 +8,51 @@ use crate::object::ownership::*;
8
8
use crate :: object:: * ;
9
9
10
10
// ----------------------------------------------------------------------------------------------------------------------------------------------
11
- // Implementation for RefKind policy
11
+ // Implementation for Memory policy
12
12
13
- /// Specialization trait depending on [`RefKind `]. This is an internal interface.
14
- pub trait RefKindSpec : Sized {
13
+ /// Specialization trait depending on [`Memory `]. This is an internal interface.
14
+ pub trait MemorySpec : Sized {
15
15
/// Pointer wrapper that may be `Drop` or not.
16
16
#[ doc( hidden) ]
17
17
type PtrWrapper : PtrWrapper ;
18
18
19
19
#[ doc( hidden) ]
20
- unsafe fn impl_from_maybe_ref_counted < T : GodotObject < RefKind = Self > > (
20
+ unsafe fn impl_from_maybe_ref_counted < T : GodotObject < Memory = Self > > (
21
21
ptr : NonNull < sys:: godot_object > ,
22
22
) -> Option < Ref < T , Unique > >
23
23
where
24
- Self : RefKind ;
24
+ Self : Memory ;
25
25
26
26
#[ doc( hidden) ]
27
- unsafe fn impl_assume_safe < ' a , T : GodotObject < RefKind = Self > > (
27
+ unsafe fn impl_assume_safe < ' a , T : GodotObject < Memory = Self > > (
28
28
this : & Ref < T , Shared > ,
29
29
) -> TRef < ' a , T , Shared >
30
30
where
31
- Self : RefKind ;
31
+ Self : Memory ;
32
32
33
33
#[ doc( hidden) ]
34
- unsafe fn impl_assume_unique < T : GodotObject < RefKind = Self > > (
34
+ unsafe fn impl_assume_unique < T : GodotObject < Memory = Self > > (
35
35
this : Ref < T , Shared > ,
36
36
) -> Ref < T , Unique >
37
37
where
38
- Self : RefKind ;
38
+ Self : Memory ;
39
39
40
40
#[ doc( hidden) ]
41
- unsafe fn maybe_add_ref < T : GodotObject < RefKind = Self > > ( raw : & RawObject < T > )
41
+ unsafe fn maybe_add_ref < T : GodotObject < Memory = Self > > ( raw : & RawObject < T > )
42
42
where
43
- Self : RefKind ;
43
+ Self : Memory ;
44
44
45
45
#[ doc( hidden) ]
46
- unsafe fn maybe_init_ref < T : GodotObject < RefKind = Self > > ( raw : & RawObject < T > )
46
+ unsafe fn maybe_init_ref < T : GodotObject < Memory = Self > > ( raw : & RawObject < T > )
47
47
where
48
- Self : RefKind ;
48
+ Self : Memory ;
49
49
}
50
50
51
- impl RefKindSpec for ManuallyManaged {
51
+ impl MemorySpec for ManuallyManaged {
52
52
type PtrWrapper = Forget ;
53
53
54
54
#[ inline( always) ]
55
- unsafe fn impl_from_maybe_ref_counted < T : GodotObject < RefKind = Self > > (
55
+ unsafe fn impl_from_maybe_ref_counted < T : GodotObject < Memory = Self > > (
56
56
ptr : NonNull < sys:: godot_object > ,
57
57
) -> Option < Ref < T , Unique > > {
58
58
if RawObject :: < ReferenceCountedClassPlaceholder > :: try_from_sys_ref ( ptr) . is_some ( ) {
@@ -71,7 +71,7 @@ impl RefKindSpec for ManuallyManaged {
71
71
}
72
72
73
73
#[ inline( always) ]
74
- unsafe fn impl_assume_safe < ' a , T : GodotObject < RefKind = Self > > (
74
+ unsafe fn impl_assume_safe < ' a , T : GodotObject < Memory = Self > > (
75
75
this : & Ref < T , Shared > ,
76
76
) -> TRef < ' a , T , Shared > {
77
77
debug_assert ! (
@@ -82,7 +82,7 @@ impl RefKindSpec for ManuallyManaged {
82
82
}
83
83
84
84
#[ inline( always) ]
85
- unsafe fn impl_assume_unique < T : GodotObject < RefKind = Self > > (
85
+ unsafe fn impl_assume_unique < T : GodotObject < Memory = Self > > (
86
86
this : Ref < T , Shared > ,
87
87
) -> Ref < T , Unique > {
88
88
debug_assert ! (
@@ -93,16 +93,16 @@ impl RefKindSpec for ManuallyManaged {
93
93
}
94
94
95
95
#[ inline]
96
- unsafe fn maybe_add_ref < T : GodotObject < RefKind = Self > > ( _raw : & RawObject < T > ) { }
96
+ unsafe fn maybe_add_ref < T : GodotObject < Memory = Self > > ( _raw : & RawObject < T > ) { }
97
97
#[ inline]
98
- unsafe fn maybe_init_ref < T : GodotObject < RefKind = Self > > ( _raw : & RawObject < T > ) { }
98
+ unsafe fn maybe_init_ref < T : GodotObject < Memory = Self > > ( _raw : & RawObject < T > ) { }
99
99
}
100
100
101
- impl RefKindSpec for RefCounted {
101
+ impl MemorySpec for RefCounted {
102
102
type PtrWrapper = UnRef ;
103
103
104
104
#[ inline( always) ]
105
- unsafe fn impl_from_maybe_ref_counted < T : GodotObject < RefKind = Self > > (
105
+ unsafe fn impl_from_maybe_ref_counted < T : GodotObject < Memory = Self > > (
106
106
ptr : NonNull < sys:: godot_object > ,
107
107
) -> Option < Ref < T , Unique > > {
108
108
if RawObject :: < ReferenceCountedClassPlaceholder > :: try_from_sys_ref ( ptr) . is_some ( ) {
@@ -120,26 +120,26 @@ impl RefKindSpec for RefCounted {
120
120
}
121
121
122
122
#[ inline( always) ]
123
- unsafe fn impl_assume_safe < ' a , T : GodotObject < RefKind = Self > > (
123
+ unsafe fn impl_assume_safe < ' a , T : GodotObject < Memory = Self > > (
124
124
this : & Ref < T , Shared > ,
125
125
) -> TRef < ' a , T , Shared > {
126
126
this. assume_safe_unchecked ( )
127
127
}
128
128
129
129
#[ inline( always) ]
130
- unsafe fn impl_assume_unique < T : GodotObject < RefKind = Self > > (
130
+ unsafe fn impl_assume_unique < T : GodotObject < Memory = Self > > (
131
131
this : Ref < T , Shared > ,
132
132
) -> Ref < T , Unique > {
133
133
this. cast_access ( )
134
134
}
135
135
136
136
#[ inline]
137
- unsafe fn maybe_add_ref < T : GodotObject < RefKind = Self > > ( raw : & RawObject < T > ) {
137
+ unsafe fn maybe_add_ref < T : GodotObject < Memory = Self > > ( raw : & RawObject < T > ) {
138
138
raw. add_ref ( ) ;
139
139
}
140
140
141
141
#[ inline]
142
- unsafe fn maybe_init_ref < T : GodotObject < RefKind = Self > > ( raw : & RawObject < T > ) {
142
+ unsafe fn maybe_init_ref < T : GodotObject < Memory = Self > > ( raw : & RawObject < T > ) {
143
143
raw. init_ref_count ( ) ;
144
144
}
145
145
}
@@ -201,9 +201,9 @@ impl Drop for UnRef {
201
201
202
202
/// Trait for constraining `assume_safe` lifetimes to the one of `&self` when `T` is
203
203
/// reference-counted. This is an internal interface.
204
- pub trait LifetimeConstraint < Kind : RefKind > { }
204
+ pub trait LifetimeConstraint < Kind : Memory > { }
205
205
206
- /// Type used to check lifetime constraint depending on `RefKind `. Internal interface.
206
+ /// Type used to check lifetime constraint depending on `Memory `. Internal interface.
207
207
#[ doc( hidden) ]
208
208
pub struct AssumeSafeLifetime < ' a , ' r > {
209
209
_marker : PhantomData < ( & ' a ( ) , & ' r ( ) ) > ,
@@ -215,19 +215,19 @@ impl<'a, 'r: 'a> LifetimeConstraint<RefCounted> for AssumeSafeLifetime<'a, 'r> {
215
215
// ----------------------------------------------------------------------------------------------------------------------------------------------
216
216
// SafeDeref, SafeAsRaw
217
217
218
- /// Trait for combinations of `RefKind ` and `ThreadAccess ` that can be dereferenced safely.
218
+ /// Trait for combinations of `Memory ` and `Ownership ` that can be dereferenced safely.
219
219
/// This is an internal interface.
220
- pub unsafe trait SafeDeref < Kind : RefKind , Own : Ownership > {
220
+ pub unsafe trait SafeDeref < Kind : Memory , Own : Ownership > {
221
221
/// Returns a safe reference to the underlying object.
222
222
#[ doc( hidden) ]
223
- fn impl_as_ref < T : GodotObject < RefKind = Kind > > ( this : & Ref < T , Own > ) -> TRef < ' _ , T , Own > ;
223
+ fn impl_as_ref < T : GodotObject < Memory = Kind > > ( this : & Ref < T , Own > ) -> TRef < ' _ , T , Own > ;
224
224
}
225
225
226
226
/// Trait for persistent `Ref`s that point to valid objects. This is an internal interface.
227
- pub unsafe trait SafeAsRaw < Kind : RefKind , Own : Ownership > {
227
+ pub unsafe trait SafeAsRaw < Kind : Memory , Own : Ownership > {
228
228
/// Returns a raw reference to the underlying object.
229
229
#[ doc( hidden) ]
230
- fn impl_as_raw < T : GodotObject < RefKind = Kind > > ( this : & Ref < T , Own > ) -> & RawObject < T > ;
230
+ fn impl_as_raw < T : GodotObject < Memory = Kind > > ( this : & Ref < T , Own > ) -> & RawObject < T > ;
231
231
}
232
232
233
233
// ----------------------------------------------------------------------------------------------------------------------------------------------
@@ -240,7 +240,7 @@ pub struct RefImplBound {
240
240
241
241
unsafe impl SafeDeref < ManuallyManaged , Unique > for RefImplBound {
242
242
#[ inline]
243
- fn impl_as_ref < T : GodotObject < RefKind = ManuallyManaged > > (
243
+ fn impl_as_ref < T : GodotObject < Memory = ManuallyManaged > > (
244
244
this : & Ref < T , Unique > ,
245
245
) -> TRef < ' _ , T , Unique > {
246
246
unsafe { this. assume_safe_unchecked ( ) }
@@ -249,14 +249,14 @@ unsafe impl SafeDeref<ManuallyManaged, Unique> for RefImplBound {
249
249
250
250
unsafe impl < Own : LocalThreadOwnership > SafeDeref < RefCounted , Own > for RefImplBound {
251
251
#[ inline]
252
- fn impl_as_ref < T : GodotObject < RefKind = RefCounted > > ( this : & Ref < T , Own > ) -> TRef < ' _ , T , Own > {
252
+ fn impl_as_ref < T : GodotObject < Memory = RefCounted > > ( this : & Ref < T , Own > ) -> TRef < ' _ , T , Own > {
253
253
unsafe { this. assume_safe_unchecked ( ) }
254
254
}
255
255
}
256
256
257
257
unsafe impl SafeAsRaw < ManuallyManaged , Unique > for RefImplBound {
258
258
#[ inline]
259
- fn impl_as_raw < T : GodotObject < RefKind = ManuallyManaged > > (
259
+ fn impl_as_raw < T : GodotObject < Memory = ManuallyManaged > > (
260
260
this : & Ref < T , Unique > ,
261
261
) -> & RawObject < T > {
262
262
unsafe { this. as_raw_unchecked ( ) }
@@ -265,7 +265,7 @@ unsafe impl SafeAsRaw<ManuallyManaged, Unique> for RefImplBound {
265
265
266
266
unsafe impl < Own : Ownership > SafeAsRaw < RefCounted , Own > for RefImplBound {
267
267
#[ inline]
268
- fn impl_as_raw < T : GodotObject < RefKind = RefCounted > > ( this : & Ref < T , Own > ) -> & RawObject < T > {
268
+ fn impl_as_raw < T : GodotObject < Memory = RefCounted > > ( this : & Ref < T , Own > ) -> & RawObject < T > {
269
269
unsafe { this. as_raw_unchecked ( ) }
270
270
}
271
271
}
0 commit comments