[][src]Struct triple_buffer::TripleBuffer

pub struct TripleBuffer<T: Send> { /* fields omitted */ }

A triple buffer, useful for nonblocking and thread-safe data sharing

A triple buffer is a single-producer single-consumer nonblocking communication channel which behaves like a shared variable: the producer submits regular updates, and the consumer accesses the latest available value whenever it feels like it.

The input and output fields of this struct are what producers and consumers actually use in practice. They can safely be moved away from the TripleBuffer struct after construction, and are further documented below.

Methods

impl<T: Clone + Send> TripleBuffer<T>[src]

pub fn new(initial: T) -> Self[src]

Construct a triple buffer with a certain initial value

impl<T: Send> TripleBuffer<T>[src]

pub fn split(self) -> (Input<T>, Output<T>)[src]

Extract input and output of the triple buffer

Trait Implementations

impl<T: Default + Send> Default for TripleBuffer<T>[src]

fn default() -> Self[src]

Construct a triple buffer with a default-constructed value

impl<T: Debug + Send> Debug for TripleBuffer<T>[src]

Auto Trait Implementations

impl<T> Send for TripleBuffer<T>

impl<T> Sync for TripleBuffer<T>

impl<T> Unpin for TripleBuffer<T>

impl<T> !UnwindSafe for TripleBuffer<T>

impl<T> !RefUnwindSafe for TripleBuffer<T>

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]