Struct simple_triple_buffer::Writer [−][src]
Write side of the triple buffer.
Implementations
impl<T> Writer<T>
[src]
pub fn write_new(&mut self, write_op: impl FnMut(&T, &mut T))
[src]
Write the next state into the buffer.
The closure takes two arguments:
- The first is a reference to the previous state.
- The second is a mutable reference to some unspecified
T
value that should be overwritten with the new state.
The Reader
is not blocked while this function runs.
It is possible for multiple independent reads to happen
while a single write is in process.
Example
let (mut writer, mut reader) = simple_triple_buffer::new_clone(0); writer.write_new(|old, new| *new = *old + 1); assert_eq!(*reader.read_newest(), 1);
Auto Trait Implementations
impl<T> !RefUnwindSafe for Writer<T>
impl<T> Send for Writer<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> !Sync for Writer<T>
impl<T> Unpin for Writer<T>
impl<T> !UnwindSafe for Writer<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,