pub struct Waiter<T>(/* private fields */);Expand description
Waiter waits for a value that has been published by Publisher. A Waiter can
be cloned and cloned instances all receive the same published value.
Implementations§
Source§impl<T> Waiter<T>
impl<T> Waiter<T>
Sourcepub fn wait_for_value(&self) -> &T
pub fn wait_for_value(&self) -> &T
Wait for the published value and return an immutable reference to it.
Sourcepub fn try_get_value(&self) -> Option<&T>
pub fn try_get_value(&self) -> Option<&T>
Attempt to get an immutable reference to the value, and return None if the value has not been published yet. This is guaranteed to succeed if wait_for_value has previously returned.
Sourcepub fn into_value(self) -> Result<T, Waiter<T>>
pub fn into_value(self) -> Result<T, Waiter<T>>
Attempt to gain exclusive ownership of the underlying value. This will
only succeed if a value has been published and this is the only Waiter
remaining. Otherwise, an Err is returned with the same
Waiter that was passed in.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Waiter<T>
impl<T> !RefUnwindSafe for Waiter<T>
impl<T> Send for Waiter<T>
impl<T> Sync for Waiter<T>
impl<T> Unpin for Waiter<T>
impl<T> !UnwindSafe for Waiter<T>
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