Struct eyeball::WeakObservable
source · pub struct WeakObservable<T, L: Lock = SyncLock> { /* private fields */ }
Expand description
A weak reference to a SharedObservable
.
This type is only useful in niche cases, since one generally shouldn’t nest interior-mutable types in observables, which includes observables themselves.
See std::sync::Weak
for a general explanation of weak references.
Implementations§
source§impl<T, L: Lock> WeakObservable<T, L>
impl<T, L: Lock> WeakObservable<T, L>
sourcepub fn upgrade(&self) -> Option<SharedObservable<T, L>>
pub fn upgrade(&self) -> Option<SharedObservable<T, L>>
Attempt to upgrade the WeakObservable
into a SharedObservable
.
Returns None
if the inner value has already been dropped.
Trait Implementations§
source§impl<T, L: Lock> Clone for WeakObservable<T, L>
impl<T, L: Lock> Clone for WeakObservable<T, L>
Auto Trait Implementations§
impl<T, L> Freeze for WeakObservable<T, L>
impl<T, L> RefUnwindSafe for WeakObservable<T, L>where
<L as Lock>::RwLock<ObservableState<T>>: RefUnwindSafe,
impl<T, L> Send for WeakObservable<T, L>
impl<T, L> Sync for WeakObservable<T, L>
impl<T, L> Unpin for WeakObservable<T, L>
impl<T, L> UnwindSafe for WeakObservable<T, L>where
<L as Lock>::RwLock<ObservableState<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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)