Struct oddio::Swap [−][src]
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]
T: Clone,
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
Auto Trait Implementations
impl<T> !RefUnwindSafe for Swap<T>
[src]
impl<T> Send for Swap<T> where
T: Send,
[src]
T: Send,
impl<T> !Sync for Swap<T>
[src]
impl<T> Unpin for Swap<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Swap<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
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>,