@@ -20,21 +20,21 @@ use crate::object::ownership::*;
2020///
2121/// This is a reference-counted collection with "interior mutability" in Rust parlance.
2222/// To enforce that the official [thread-safety guidelines][thread-safety] are
23- /// followed this type uses the *typestate* pattern. The typestate `Access ` tracks
23+ /// followed this type uses the *typestate* pattern. The typestate `Ownership ` tracks
2424/// whether there is thread-local or unique access (where pretty much all operations are safe)
2525/// or whether the value might be "shared", in which case not all operations are
2626/// safe.
2727///
2828/// [thread-safety]: https://docs.godotengine.org/en/stable/tutorials/threads/thread_safe_apis.html
29- pub struct Dictionary < Access : ThreadAccess = Shared > {
29+ pub struct Dictionary < Own : Ownership = Shared > {
3030 sys : sys:: godot_dictionary ,
3131
3232 /// Marker preventing the compiler from incorrectly deriving `Send` and `Sync`.
33- _marker : PhantomData < Access > ,
33+ _marker : PhantomData < Own > ,
3434}
3535
3636/// Operations allowed on all Dictionaries at any point in time.
37- impl < Access : ThreadAccess > Dictionary < Access > {
37+ impl < Own : Ownership > Dictionary < Own > {
3838 /// Returns `true` if the `Dictionary` contains no elements.
3939 #[ inline]
4040 pub fn is_empty ( & self ) -> bool {
@@ -58,7 +58,7 @@ impl<Access: ThreadAccess> Dictionary<Access> {
5858
5959 /// Returns true if the `Dictionary` has all of the keys in the given array.
6060 #[ inline]
61- pub fn contains_all < ArrAccess : ThreadAccess > ( & self , keys : & VariantArray < ArrAccess > ) -> bool {
61+ pub fn contains_all < ArrayOws : Ownership > ( & self , keys : & VariantArray < ArrayOws > ) -> bool {
6262 unsafe { ( get_api ( ) . godot_dictionary_has_all ) ( self . sys ( ) , keys. sys ( ) ) }
6363 }
6464
@@ -200,7 +200,7 @@ impl<Access: ThreadAccess> Dictionary<Access> {
200200 /// Modifying the same underlying collection while observing the safety assumptions will
201201 /// not violate memory safely, but may lead to surprising behavior in the iterator.
202202 #[ inline]
203- pub fn iter ( & self ) -> Iter < Access > {
203+ pub fn iter ( & self ) -> Iter < Own > {
204204 Iter :: new ( self )
205205 }
206206
@@ -238,7 +238,7 @@ impl<Access: ThreadAccess> Dictionary<Access> {
238238 }
239239 }
240240
241- unsafe fn cast_access < A : ThreadAccess > ( self ) -> Dictionary < A > {
241+ unsafe fn cast_access < A : Ownership > ( self ) -> Dictionary < A > {
242242 let sys = self . sys ;
243243 std:: mem:: forget ( self ) ;
244244 Dictionary :: from_sys ( sys)
@@ -264,7 +264,7 @@ impl Dictionary<ThreadLocal> {
264264}
265265
266266/// Operations allowed on Dictionaries that are not unique.
267- impl < Access : NonUniqueThreadAccess > Dictionary < Access > {
267+ impl < Own : NonUniqueOwnership > Dictionary < Own > {
268268 /// Assume that this is the only reference to this dictionary, on which
269269 /// operations that change the container size can be safely performed.
270270 ///
@@ -282,7 +282,7 @@ impl<Access: NonUniqueThreadAccess> Dictionary<Access> {
282282}
283283
284284/// Operations allowed on Dictionaries that can only be referenced to from the current thread.
285- impl < Access : LocalThreadAccess > Dictionary < Access > {
285+ impl < Own : LocalThreadOwnership > Dictionary < Own > {
286286 #[ inline]
287287 /// Inserts or updates the value of the element corresponding to the key.
288288 pub fn insert < K , V > ( & self , key : K , val : V )
@@ -340,7 +340,7 @@ impl Dictionary<Unique> {
340340 }
341341}
342342
343- impl < Access : ThreadAccess > Drop for Dictionary < Access > {
343+ impl < Own : Ownership > Drop for Dictionary < Own > {
344344 #[ inline]
345345 fn drop ( & mut self ) {
346346 unsafe { ( get_api ( ) . godot_dictionary_destroy ) ( self . sys_mut ( ) ) }
@@ -368,7 +368,7 @@ impl Default for Dictionary<ThreadLocal> {
368368 }
369369}
370370
371- impl < Access : NonUniqueThreadAccess > NewRef for Dictionary < Access > {
371+ impl < Own : NonUniqueOwnership > NewRef for Dictionary < Own > {
372372 #[ inline]
373373 fn new_ref ( & self ) -> Self {
374374 unsafe {
@@ -393,15 +393,15 @@ impl From<Dictionary<Unique>> for Dictionary<ThreadLocal> {
393393 }
394394}
395395
396- impl < Access : ThreadAccess > fmt:: Debug for Dictionary < Access > {
396+ impl < Own : Ownership > fmt:: Debug for Dictionary < Own > {
397397 #[ inline]
398398 fn fmt ( & self , f : & mut fmt:: Formatter ) -> Result < ( ) , fmt:: Error > {
399399 self . to_json ( ) . to_string ( ) . fmt ( f)
400400 }
401401}
402402
403- unsafe fn iter_next < Access : ThreadAccess > (
404- dic : & Dictionary < Access > ,
403+ unsafe fn iter_next < Own : Ownership > (
404+ dic : & Dictionary < Own > ,
405405 last_key : & mut Option < Variant > ,
406406) -> Option < ( Variant , Variant ) > {
407407 let last_ptr = last_key. as_ref ( ) . map_or ( std:: ptr:: null ( ) , Variant :: sys) ;
@@ -421,22 +421,22 @@ unsafe fn iter_next<Access: ThreadAccess>(
421421///
422422/// This struct is created by the `iter` method on `Dictionary<Unique>`.
423423#[ derive( Debug ) ]
424- pub struct Iter < ' a , Access : ThreadAccess > {
425- dic : & ' a Dictionary < Access > ,
424+ pub struct Iter < ' a , Own : Ownership > {
425+ dic : & ' a Dictionary < Own > ,
426426 last_key : Option < Variant > ,
427427}
428428
429- impl < ' a , Access : ThreadAccess > Iter < ' a , Access > {
429+ impl < ' a , Own : Ownership > Iter < ' a , Own > {
430430 /// Create an Iterator from a unique Dictionary.
431- fn new ( dic : & ' a Dictionary < Access > ) -> Self {
431+ fn new ( dic : & ' a Dictionary < Own > ) -> Self {
432432 Iter {
433433 dic,
434434 last_key : None ,
435435 }
436436 }
437437}
438438
439- impl < ' a , Access : ThreadAccess > Iterator for Iter < ' a , Access > {
439+ impl < ' a , Own : Ownership > Iterator for Iter < ' a , Own > {
440440 type Item = ( Variant , Variant ) ;
441441
442442 #[ inline]
@@ -451,9 +451,9 @@ impl<'a, Access: ThreadAccess> Iterator for Iter<'a, Access> {
451451 }
452452}
453453
454- impl < ' a , Access : ThreadAccess > IntoIterator for & ' a Dictionary < Access > {
454+ impl < ' a , Own : Ownership > IntoIterator for & ' a Dictionary < Own > {
455455 type Item = ( Variant , Variant ) ;
456- type IntoIter = Iter < ' a , Access > ;
456+ type IntoIter = Iter < ' a , Own > ;
457457 #[ inline]
458458 fn into_iter ( self ) -> Self :: IntoIter {
459459 self . iter ( )
@@ -517,7 +517,7 @@ where
517517 }
518518}
519519
520- impl < K , V , Access : LocalThreadAccess > Extend < ( K , V ) > for Dictionary < Access >
520+ impl < K , V , Own : LocalThreadOwnership > Extend < ( K , V ) > for Dictionary < Own >
521521where
522522 K : ToVariantEq + OwnedToVariant ,
523523 V : OwnedToVariant ,
0 commit comments