pub struct Receiver<I, P>where
P: Ord,{ /* private fields */ }
Expand description
Receive side of the channel. Can be cloned.
Implementations§
Source§impl<I, P> Receiver<I, P>where
P: Ord,
impl<I, P> Receiver<I, P>where
P: Ord,
Sourcepub fn try_recv(&self) -> Result<(I, P), TryRecvError>
pub fn try_recv(&self) -> Result<(I, P), TryRecvError>
Attempts to receive a message from the channel.
If the channel is empty or closed, this method returns an error.
Sourcepub async fn recv(&self) -> Result<(I, P), RecvError>
pub async fn recv(&self) -> Result<(I, P), RecvError>
Receives a message from the channel.
If the channel is empty, this method waits until there is a message.
If the channel is closed, this method receives a message or returns an error if there are no more messages.
Sourcepub fn close(&self) -> bool
pub fn close(&self) -> bool
Closes the channel and notifies all blocked operations.
Returns true
if this call has closed the channel and it was not closed already.
Sourcepub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Returns the number of receivers for the channel.
Sourcepub fn sender_count(&self) -> usize
pub fn sender_count(&self) -> usize
Returns the number of senders for the channel.
Trait Implementations§
Auto Trait Implementations§
impl<I, P> Freeze for Receiver<I, P>
impl<I, P> RefUnwindSafe for Receiver<I, P>
impl<I, P> Send for Receiver<I, P>
impl<I, P> Sync for Receiver<I, P>
impl<I, P> Unpin for Receiver<I, P>
impl<I, P> UnwindSafe for Receiver<I, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more