Struct simple_triple_buffer::Reader[][src]

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

Read side of the triple buffer.

Implementations

impl<T> Reader<T>[src]

pub fn read_newest(&mut self) -> &T[src]

Get a view to the newest state currently in the buffer.

The Writer is not blocked while the returned borrow is held, but any new written data will only be visible by calling this method again.

It is possible for multiple write updates to happen while a single read is in process.

Example

let (mut writer, mut reader) = simple_triple_buffer::new_clone(0);

let guard = reader.read_newest();
assert_eq!(*guard, 0);

writer.write_new(|old, new| *new = *old + 1);
assert_eq!(*guard, 0);

let guard = reader.read_newest();
assert_eq!(*guard, 1);

Auto Trait Implementations

impl<T> !RefUnwindSafe for Reader<T>

impl<T> Send for Reader<T> where
    T: Send + Sync

impl<T> !Sync for Reader<T>

impl<T> Unpin for Reader<T>

impl<T> !UnwindSafe for Reader<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.