pub trait BlockingRxTrait<T: Send + 'static>:
Send
+ 'static
+ Debug
+ Display
+ AsRef<ChannelShared<T>> {
// Required methods
fn recv<'a>(&'a self) -> Result<T, RecvError>;
fn try_recv(&self) -> Result<T, TryRecvError>;
fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError>;
fn clone_to_vec(self, count: usize) -> Vec<Self>
where Self: Sized;
// Provided methods
fn len(&self) -> usize { ... }
fn capacity(&self) -> Option<usize> { ... }
fn is_empty(&self) -> bool { ... }
fn is_full(&self) -> bool { ... }
fn is_disconnected(&self) -> bool { ... }
}Expand description
For writing generic code with MRx & Rx
Required Methods§
Sourcefn recv<'a>(&'a self) -> Result<T, RecvError>
fn recv<'a>(&'a self) -> Result<T, 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.
Sourcefn try_recv(&self) -> Result<T, TryRecvError>
fn try_recv(&self) -> Result<T, 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.
Sourcefn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError>
fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError>
Receives a message from the channel with a timeout. Will block when channel is empty.
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.
fn clone_to_vec(self, count: usize) -> Vec<Self>where
Self: Sized,
Provided Methods§
Sourcefn capacity(&self) -> Option<usize>
fn capacity(&self) -> Option<usize>
The capacity of the channel, return None for unbounded channel.
Sourcefn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
Return true if the other side has closed