pub struct MRx<F: Flavor>(/* private fields */);Expand description
A multi-consumer (receiver) that works in a blocking context.
Inherits from Rx<F> and implements Clone.
Additional methods can be accessed through Deref<Target=[ChannelShared]>.
You can use into() to convert it to Rx<F>.
Implementations§
Methods from Deref<Target = Rx<F>>§
Sourcepub fn recv(&self) -> Result<F::Item, RecvError>
pub fn recv(&self) -> Result<F::Item, RecvError>
Receives a message from the channel. This method will block until a message is received or the channel is closed.
Returns Ok(T) on success.
Returns Err(RecvError) if the sender has been dropped.
Sourcepub fn try_recv(&self) -> Result<F::Item, TryRecvError>
pub fn try_recv(&self) -> Result<F::Item, TryRecvError>
Attempts to receive a message from the channel without blocking.
Returns Ok(T) when successful.
Returns Err(TryRecvError::Empty) if the channel is empty.
Returns Err(TryRecvError::Disconnected) if the sender has been dropped and the channel is empty.
Sourcepub fn recv_timeout(
&self,
timeout: Duration,
) -> Result<F::Item, RecvTimeoutError>
pub fn recv_timeout( &self, timeout: Duration, ) -> Result<F::Item, RecvTimeoutError>
Receives a message from the channel with a timeout. Will block when channel is empty.
The behavior is atomic: the message is either received successfully or the operation is canceled due to a timeout.
Returns Ok(T) when successful.
Returns Err(RecvTimeoutError::Timeout) when a message could not be received because the channel is empty and the operation timed out.
Returns Err(RecvTimeoutError::Disconnected) if the sender has been dropped and the channel is empty.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Return true if the other side has closed
Sourcepub fn read_select(&self, result: SelectResult) -> Result<F::Item, RecvError>where
F: FlavorSelect,
pub fn read_select(&self, result: SelectResult) -> Result<F::Item, RecvError>where
F: FlavorSelect,
Methods from Deref<Target = ChannelShared<F>>§
Trait Implementations§
Source§fn as_ref(&self) -> &ChannelShared<F>
fn as_ref(&self) -> &ChannelShared<F>
Source§impl<F> BlockingRxTrait<<F as Queue>::Item> for MRx<F>
impl<F> BlockingRxTrait<<F as Queue>::Item> for MRx<F>
Source§fn capacity(&self) -> Option<usize>
fn capacity(&self) -> Option<usize>
The capacity of the channel, return None for unbounded channel.
Source§fn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
Return true if the other side has closed