struct Status<T> {
mutex: Mutex<T>,
condvar: Condvar,
}Fields§
§mutex: Mutex<T>§condvar: CondvarImplementations§
Source§impl<T> Status<T>
impl<T> Status<T>
Sourcefn try_notify_one(&self, t: T) -> Result<(), PoisonError<MutexGuard<'_, T>>>
fn try_notify_one(&self, t: T) -> Result<(), PoisonError<MutexGuard<'_, T>>>
Attempts to set the status to the given value and notifies one waiting thread.
Fails if the Mutex is poisoned.
Sourcefn notify_one_if(&self, predicate: impl Fn(&T) -> bool, t: T)
fn notify_one_if(&self, predicate: impl Fn(&T) -> bool, t: T)
If the predicate is true on this status, sets the status to the given value and notifies one waiting thread.
Sourcefn notify_all(&self, t: T)
fn notify_all(&self, t: T)
Sets the status to the given value and notifies all waiting threads.
Sourcefn wait_while(&self, predicate: impl FnMut(&mut T) -> bool) -> MutexGuard<'_, T>
fn wait_while(&self, predicate: impl FnMut(&mut T) -> bool) -> MutexGuard<'_, T>
Waits until the predicate is true on this status.
This returns a MutexGuard, allowing to further inspect or modify the
status.
Auto Trait Implementations§
impl<T> !Freeze for Status<T>
impl<T> RefUnwindSafe for Status<T>
impl<T> Send for Status<T>where
T: Send,
impl<T> Sync for Status<T>where
T: Send,
impl<T> Unpin for Status<T>where
T: Unpin,
impl<T> UnwindSafe for Status<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
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