pub struct Receiver<T> { /* private fields */ }Expand description
Receives a value from the associated Sender.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn has_message(&self) -> bool
pub fn has_message(&self) -> bool
Returns true if there is a message in the channel, ready to be received.
If true is returned, the next call to receive the message is guaranteed to return
the message immediately.
Sourcepub fn try_recv(&self) -> Result<Option<T>, RecvError>
pub fn try_recv(&self) -> Result<Option<T>, RecvError>
Checks if there is a message in the channel without blocking. Returns:
Ok(Some(message))if there was a message in the channel.Ok(None)if theSenderis alive, but has not yet sent a message.Err(RecvError)if theSenderwas dropped before sending anything or if the message has already been extracted by a previoustry_recvcall.
If a message is returned, the channel is disconnected and any subsequent receive operation
using this receiver will return an RecvError.
Trait Implementations§
Source§impl<T> IntoFuture for Receiver<T>
impl<T> IntoFuture for Receiver<T>
Source§type IntoFuture = Recv<T>
type IntoFuture = Recv<T>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
impl<T: Send> Send for Receiver<T>
Auto Trait Implementations§
impl<T> Freeze for Receiver<T>
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !Sync for Receiver<T>
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