pub struct WeakRef<T>(/* private fields */);Expand description
A weak reference to a shared owned object. The upgrade method try to build a TempRef from a
WeakRef and will fail if there is no OwnedRef left.
Implementations§
Source§impl<T> WeakRef<T>
impl<T> WeakRef<T>
pub fn new() -> Self
Sourcepub fn upgrade(&self) -> Option<TempRef<'_, T>>
pub fn upgrade(&self) -> Option<TempRef<'_, T>>
Try to upgrade the WeakRef into a TempRef. This will fail as soon as the last
OwnedRef is released, even if some TempRef still exist at that time. The returned
TempRef must be dropped as soon as possible. In particular, it must not be kept across
blocking calls.
Sourcepub fn re_own(&self) -> Option<OwnedRef<T>>
pub fn re_own(&self) -> Option<OwnedRef<T>>
Try to upgrade the WeakRef into a OwnedRef. This will fail as soon as the last
OwnedRef is released.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for WeakRef<T>
impl<T> RefUnwindSafe for WeakRef<T>where
T: RefUnwindSafe,
impl<T> Send for WeakRef<T>
impl<T> Sync for WeakRef<T>
impl<T> Unpin for WeakRef<T>
impl<T> UnwindSafe for WeakRef<T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more