pub struct Receiver<T> { /* private fields */ }
Expand description
Receiver half of the forwarder
Call try_receive
to examine if the result has been
sent from the sender. Receiver
also implements the Future
trait, so you
can use it in an async block or function to receive the result
asynchronously.
See also the module-level documentation for more information.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn try_receive(&self) -> Result<T, TryReceiveError>
pub fn try_receive(&self) -> Result<T, TryReceiveError>
Receives a value from the sender.
This method is similar to poll
, but it does not require
a Context
argument. If the value has not been sent yet, this method
returns Err(TryReceiveError::NotSent)
.
Trait Implementations§
Source§impl<T> Future for Receiver<T>
impl<T> Future for Receiver<T>
Source§fn poll(self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll<T>
fn poll(self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll<T>
Polls the receiver to receive the value.
This method is similar to try_receive
, but it
requires a Context
argument. If the value has not been sent yet, this
method returns Poll::Pending
and stores the Waker
from the Context
for waking up the current task when the value is sent.
This method should not be called after the value has been received.