pub struct ConditionVariable<T> { /* private fields */ }
Implementations§
Source§impl<T: PartialEq + Clone> ConditionVariable<T>
impl<T: PartialEq + Clone> ConditionVariable<T>
pub fn new(value: T) -> ConditionVariable<T>
pub fn set(&self, value: T, notify: Notify)
pub fn touch(&self, notify: Notify)
pub fn get(&self) -> Result<T, PoisonError<MutexGuard<'_, T>>>
pub fn wait_for( &self, expected: T, ) -> Result<(), PoisonError<MutexGuard<'_, T>>>
pub fn wait_for_in( &self, expected: &[T], ) -> Result<(), PoisonError<MutexGuard<'_, T>>>
pub fn wait_for_update(&self) -> Result<(), PoisonError<MutexGuard<'_, T>>>
pub fn wait_for_condition<F: FnMut(&T) -> bool>( &self, cond_func: F, ) -> Result<(), PoisonError<MutexGuard<'_, T>>>
pub fn wait_for_ms( &self, expected: T, timeout_ms: i64, ) -> Result<bool, PoisonError<(MutexGuard<'_, T>, bool)>>
pub fn wait_for_in_ms( &self, expected: &[T], timeout_ms: i64, ) -> Result<bool, PoisonError<(MutexGuard<'_, T>, bool)>>
pub fn wait_for_update_ms( &self, timeout_ms: i64, ) -> Result<bool, PoisonError<(MutexGuard<'_, T>, bool)>>
pub fn wait_for_condition_ms<F: FnMut(&T) -> bool>( &self, cond_func: F, timeout_ms: i64, ) -> Result<bool, PoisonError<(MutexGuard<'_, T>, bool)>>
Source§impl<T: PartialEq + Clone + Send> ConditionVariable<T>
impl<T: PartialEq + Clone + Send> ConditionVariable<T>
Sourcepub fn as_channel_once(&self) -> Receiver<T>
pub fn as_channel_once(&self) -> Receiver<T>
Sends out a value over the channel as soon as the ConditionVariable changes its value
Source§impl ConditionVariable<()>
impl ConditionVariable<()>
Sourcepub fn wait_ms(&self, timeout_ms: u32) -> LockResult<(MutexGuard<'_, ()>, bool)>
pub fn wait_ms(&self, timeout_ms: u32) -> LockResult<(MutexGuard<'_, ()>, bool)>
waits for a notify (useful if T==())
Auto Trait Implementations§
impl<T> !Freeze for ConditionVariable<T>
impl<T> RefUnwindSafe for ConditionVariable<T>
impl<T> Send for ConditionVariable<T>where
T: Send,
impl<T> Sync for ConditionVariable<T>where
T: Send,
impl<T> Unpin for ConditionVariable<T>where
T: Unpin,
impl<T> UnwindSafe for ConditionVariable<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