Struct simple_triple_buffer::Writer[][src]

pub struct Writer<T> { /* fields omitted */ }

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

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.