Expand description
VWeak
is a version of Prc
that holds a non-owning reference to the
managed allocation in the volatile heap. The allocation is accessed by
calling promote
on the VWeak
pointer, which returns an
Option
<
Prc
<T>>
.
Since a VWeak
reference does not count towards ownership, it will not
prevent the value stored in the allocation from being dropped, and VWeak
itself makes no guarantees about the value still being present. Thus it may
return None
when promote
d. Note however that a VWeak
reference,
unlike Weak
, does NOT prevent the allocation itself (the backing
store) from being deallocated.
A VWeak
pointer is useful for keeping a temporary reference to the
persistent allocation managed by Prc
without preventing its inner value
from being dropped from … It is also used to
prevent circular references between Prc
pointers, since mutual owning references
would never allow either Prc
to be dropped. For example, a tree could
have strong Prc
pointers from parent nodes to children, and Weak
pointers from children back to their parents.
The typical way to obtain a VWeak
pointer is to call Prc::demote
.
Implementations
Trait Implementations
impl<T: ?Sized, A: MemPool> PSafe for VWeak<T, A>
impl<T: ?Sized, A: MemPool> !PSend for VWeak<T, A>
impl<T: ?Sized, A: MemPool> RefUnwindSafe for VWeak<T, A>
impl<T: ?Sized, A: MemPool> !Send for VWeak<T, A>
impl<T: ?Sized, A: MemPool> !Sync for VWeak<T, A>
impl<T: ?Sized, A: MemPool> TxInSafe for VWeak<T, A>
impl<T: ?Sized, A: MemPool> TxOutSafe for VWeak<T, A>
impl<T: ?Sized, A: MemPool> UnwindSafe for VWeak<T, A>
Auto Trait Implementations
impl<T, A> LooseTxInUnsafe for VWeak<T, A>
impl<T: ?Sized, A> Unpin for VWeak<T, A>
impl<T: ?Sized, A> VSafe for VWeak<T, A>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more