pub struct ImmutableWeakArray<T: Sized, TAllocator = StdAllocator>where
TAllocator: Allocator,{ /* private fields */ }
Expand description
A weak reference to an ImmutableArray
.
It doesn’t provide direct access to the data itself,
but is useful for tracking whether the associated ImmutableArray
is still alive or not. Through ImmutableWeakArray::upgrade
method.
Implementations§
Source§impl<T: Sized, TAllocator: Allocator> ImmutableWeakArray<T, TAllocator>
impl<T: Sized, TAllocator: Allocator> ImmutableWeakArray<T, TAllocator>
Sourcepub fn upgrade(&self) -> Option<ImmutableArray<T, TAllocator>>
pub fn upgrade(&self) -> Option<ImmutableArray<T, TAllocator>>
Upgrades the weak reference to a strong ImmutableArray
reference.
Returns None
if the array has been deallocated. Otherwise, returns a strong reference.
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Returns the number of strong references to the string.
Sourcepub fn weak_count(&self) -> usize
pub fn weak_count(&self) -> usize
Returns the number of weak references to the string.
Trait Implementations§
Auto Trait Implementations§
impl<T, TAllocator> Freeze for ImmutableWeakArray<T, TAllocator>
impl<T, TAllocator> RefUnwindSafe for ImmutableWeakArray<T, TAllocator>where
<TAllocator as Allocator>::TAllocatedMemory: RefUnwindSafe,
TAllocator: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, TAllocator> Send for ImmutableWeakArray<T, TAllocator>
impl<T, TAllocator> Sync for ImmutableWeakArray<T, TAllocator>
impl<T, TAllocator> Unpin for ImmutableWeakArray<T, TAllocator>
impl<T, TAllocator> UnwindSafe for ImmutableWeakArray<T, TAllocator>where
<TAllocator as Allocator>::TAllocatedMemory: UnwindSafe,
TAllocator: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more