Struct nb_sync::fifo::Sender[][src]

pub struct Sender<'a, 'b: 'a, T: 'b> { /* fields omitted */ }

Channel Sender removing the need for a NonReentrant

The Channel Sender is not clonable. Since it uses a &mut self on the send function, it eliminates the need for the caller to explicitly guarantee non-reentrancy when calling the send function.

Methods

impl<'a, 'b: 'a, T: 'b> Sender<'a, 'b, T>
[src]

Sends an item on the channel.

This returns a Ok(()) if successful, otherwise it returns a WouldBlock. It is only unsuccessful if the Channel is full.

This does not require a NonReentrant guarantee since the &mut self is guarantee enough.

Sends an item on the channel, preserving the passed value if unsuccessful

This returns a (Ok(()), None) if successful, otherwise it returns a WouldBlock. It is only unsuccessful if the Channel is full. If it is unsuccessful, the function will return (Err(nb::Error::WouldBlock), Some(T)). The Option<T> will contain the unsent value.

This does not require a NonReentrant guarantee since the &mut self is guarantee enough.

Sends an item on the channel, returning a SendCompletion. This consumes the Sender for the duration of the SendCompletion.

The SendCompletion provides a more ergonomic poll method which is easily used with nb's await! macro when using a non-clonable T.

Trait Implementations

impl<'a, 'b: 'a, T: Debug + 'b> Debug for Sender<'a, 'b, T>
[src]

Formats the value using the given formatter. Read more

impl<'a, 'b: 'a, T: Send + 'b> Send for Sender<'a, 'b, T>
[src]

impl<'a, 'b: 'a, T: 'b> !Sync for Sender<'a, 'b, T>
[src]