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]
impl<'a, 'b: 'a, T: 'b> Sender<'a, 'b, T>
pub fn send(&mut self, value: T) -> Result<(), !>
[src]
pub fn send(&mut self, value: T) -> Result<(), !>
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.
pub fn send_lossless(&mut self, value: T) -> (Result<(), !>, Option<T>)
[src]
pub fn send_lossless(&mut self, value: T) -> (Result<(), !>, Option<T>)
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.
pub fn send_with_completion(self, value: T) -> SendCompletion<'a, 'b, T>
[src]
pub fn send_with_completion(self, value: T) -> SendCompletion<'a, 'b, T>
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
.