pub struct Exchanger<T> { /* private fields */ }Available on crate feature
std only.Expand description
Faster exchange operation than a simple mutex that uses a flag to indicate if new data is available.
Implementations§
Source§impl<T> Exchanger<T>
impl<T> Exchanger<T>
Sourcepub fn new_data_available(&self) -> bool
pub fn new_data_available(&self) -> bool
Returns the value of the new data available flag
Sourcepub fn set_data_changed(&self)
pub fn set_data_changed(&self)
Assert the new data available flag
Sourcepub fn replace_data(&self, new_data: T) -> Option<T>
pub fn replace_data(&self, new_data: T) -> Option<T>
Replaces any data in the exchanger with the provided data. Asserts the data has been changed.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Exchanger<T>
impl<T> RefUnwindSafe for Exchanger<T>
impl<T> Send for Exchanger<T>where
T: Send,
impl<T> Sync for Exchanger<T>where
T: Send,
impl<T> Unpin for Exchanger<T>
impl<T> UnwindSafe for Exchanger<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