Struct simple_triple_buffer::Reader [−][src]
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,
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]
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>,