pub struct CWeak<T, TAllocator: Allocator> { /* private fields */ }Expand description
A weak reference to the underlying CArc.
This object cannot inspect the underlying value (unless T is Copy).
But it does track weak references, and each weak reference can build
a strong reference, assuming any other strong reference is alive.
Implementations§
Source§impl<T, TAllocator: Allocator> CWeak<T, TAllocator>
impl<T, TAllocator: Allocator> CWeak<T, TAllocator>
Sourcepub fn strong_count(&self) -> u32
pub fn strong_count(&self) -> u32
Returns the number of strong references to the CWeak.
Sourcepub fn weak_count(&self) -> u32
pub fn weak_count(&self) -> u32
Returns the number of weak references to the CWeak.
Sourcepub fn data(&self) -> &Twhere
T: Copy,
pub fn data(&self) -> &Twhere
T: Copy,
Returns a reference to the underlying data.
This function is only available if T implements Copy.
That is because being Copy means it is not Drop. And
so we don’t need strong references to keep the data alive.
Sourcepub fn upgrade(&self) -> Result<CArc<T, TAllocator>, WeakUpgradeError>
pub fn upgrade(&self) -> Result<CArc<T, TAllocator>, WeakUpgradeError>
Trait Implementations§
Auto Trait Implementations§
impl<T, TAllocator> Freeze for CWeak<T, TAllocator>
impl<T, TAllocator> RefUnwindSafe for CWeak<T, TAllocator>where
T: RefUnwindSafe,
TAllocator: RefUnwindSafe,
impl<T, TAllocator> Send for CWeak<T, TAllocator>
impl<T, TAllocator> Sync for CWeak<T, TAllocator>
impl<T, TAllocator> Unpin for CWeak<T, TAllocator>
impl<T, TAllocator> UnsafeUnpin for CWeak<T, TAllocator>
impl<T, TAllocator> UnwindSafe for CWeak<T, TAllocator>where
T: UnwindSafe,
TAllocator: 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