pub struct Receiver<T>(/* private fields */);Expand description
The receiving end of a channel.
Use bounded,unbounded or rendezvous to create a channel.
§Work Stealing
Cloning the receiver does not turn this channel into a broadcast channel. Each message will only be received by a single receiver. You can use this to to implement work stealing.
Implementations§
source§impl<T> Receiver<T>
impl<T> Receiver<T>
sourcepub async fn recv(&self) -> Result<T, RecvError>
pub async fn recv(&self) -> Result<T, RecvError>
Wait for an incoming value from the channel associated with this receiver.
Returns an error if all senders have been dropped.
sourcepub async fn recv_deadline(
&self,
deadline: impl Into<Deadline>
) -> Result<T, RecvTimeoutError>
pub async fn recv_deadline( &self, deadline: impl Into<Deadline> ) -> Result<T, RecvTimeoutError>
Wait for an incoming value from the channel associated with this receiver.
Returns an error if all senders have been dropped or the deadline is reached.
sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if all senders for this channel have been dropped.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the channel is empty.
Note: rendezvous channels are always empty.
sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Returns true if the channel is full.
Note: rendezvous channels are always full and unbounded channels are never full.