pub struct Receiver<T> { /* private fields */ }
Expand description
A cloneable receiver for a channel.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true
if the channel is closed.
The channel is closed if all Sender
clones are dropped.
Sourcepub async fn recv(&self) -> Result<T, ClosedError>
pub async fn recv(&self) -> Result<T, ClosedError>
Waits for an available message in the channel and receives it.
Sourcepub fn try_recv(&self) -> Result<Option<T>, ClosedError>
pub fn try_recv(&self) -> Result<Option<T>, ClosedError>
Attempts to immediately receive an available message from the channel.
If the channel is empty, this function returns None
.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Receiver<T>
impl<T> RefUnwindSafe for Receiver<T>
impl<T> Send for Receiver<T>where
T: Send,
impl<T> Sync for Receiver<T>where
T: Send,
impl<T> Unpin for Receiver<T>
impl<T> UnwindSafe for Receiver<T>
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