pub struct Receiver<T> { /* private fields */ }
Expand description
The receiving side of a channel.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn recv_timeout<D>(&self, timeout: D) -> Result<T, RecvError>
pub fn recv_timeout<D>(&self, timeout: D) -> Result<T, RecvError>
Waits for a message to be received from the channel, but only for a limited time.
If the channel is empty and not disconnected, this call will block until the receive operation can proceed or the operation times out. wake up and return an error.
Sourcepub fn recv(&self) -> Result<T, RecvError>
pub fn recv(&self) -> Result<T, RecvError>
Blocks the current thread until a message is received or the channel is empty and disconnected.
If the channel is empty and not disconnected, this call will block until the receive operation can proceed.
Sourcepub fn try_recv(&self) -> Result<T, RecvError>
pub fn try_recv(&self) -> Result<T, RecvError>
Attempts to receive a message from the channel without blocking.
This method will either receive a message from the channel immediately, or return an error if the channel is empty.
This method is safe to use from IRQ context, if and only if the channel was created as a bounded channel.
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn recv_timeout_async<'a>(
&'a self,
timeout: impl Into<Timeout>,
) -> impl Future<Output = Result<T, RecvError>> + 'a
pub fn recv_timeout_async<'a>( &'a self, timeout: impl Into<Timeout>, ) -> impl Future<Output = Result<T, RecvError>> + 'a
Waits for a message to be received from the channel, but only for a limited time. Async version.
If the channel is empty and not disconnected, this call will block until the receive operation can proceed or the operation times out. wake up and return an error.
Sourcepub async fn recv_async(&self) -> Result<T, RecvError>
pub async fn recv_async(&self) -> Result<T, RecvError>
Blocks the current thread until a message is received or the channel is empty and disconnected. Async version.
If the channel is empty and not disconnected, this call will block until the receive operation can proceed.