Struct async_channel::Receiver
source · [−]pub struct Receiver<T: Send> { /* private fields */ }
Expand description
The receiver side of a channel.
Implementations
sourceimpl<T: Send> Receiver<T>
impl<T: Send> Receiver<T>
sourcepub fn receive(&self) -> Result<T, ChannelError>
pub fn receive(&self) -> Result<T, ChannelError>
Receive a message, blocking until a message is available in the buffer.
Returns the message if it was received properly, otherwise returns an error of ChannelError
type.
sourcepub fn try_receive(&self) -> Result<T, ChannelError>
pub fn try_receive(&self) -> Result<T, ChannelError>
Tries to receive a message, only succeeding if a message is already available in the buffer.
If receive succeeds returns Some(Ok(T))
.
If an endpoint is disconnected returns Some(Err(ChannelStatus::Disconnected))
.
If no such message exists, it returns None
without blocking
sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if the channel is disconnected.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> Send for Receiver<T> where
T: Sync,
impl<T> Sync for Receiver<T> where
T: Sync,
impl<T> Unpin for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more