Struct oddio::Swap[][src]

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

SPSC queue that only retains the last element sent

Useful for custom controllable signals.

Implementations

impl<T> Swap<T>[src]

pub fn new(x: T) -> Self where
    T: Clone
[src]

Create a channel initially holding x

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

Access the value that will be sent next. Producer only.

pub fn flush(&self)[src]

Send the value from pending. Producer only.

pub fn refresh(&self) -> bool[src]

Update the value exposed by recv. Returns whether new data was obtained. Consumer only.

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

Access the most recent data as of the last refresh call. Consumer only.

Trait Implementations

impl<T: Default> Default for Swap<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Swap<T>[src]

impl<T> Send for Swap<T> where
    T: Send
[src]

impl<T> !Sync for Swap<T>[src]

impl<T> Unpin for Swap<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Swap<T> where
    T: UnwindSafe
[src]

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.