pub struct UnboundedReceiver<T>(/* private fields */);
Expand description
An unbounded receiver, created with unbounded
Implementations§
Source§impl<T> UnboundedReceiver<T>
impl<T> UnboundedReceiver<T>
Sourcepub async fn recv(&self) -> Result<T, UnboundedRecvError>
pub async fn recv(&self) -> Result<T, UnboundedRecvError>
Receive a value from the receiver half of this channel.
Will block until a value is received
§Errors
Will produce an error if all senders are dropped
Sourcepub fn into_stream(self) -> UnboundedStream<T>
pub fn into_stream(self) -> UnboundedStream<T>
Turn this receiver into a stream.
Sourcepub fn try_recv(&self) -> Result<T, UnboundedTryRecvError>
pub fn try_recv(&self) -> Result<T, UnboundedTryRecvError>
Try to receive a value from the receiver.
§Errors
Will return an error if no value is currently queued. This function will not block.
Sourcepub async fn drain_at_least_one(&self) -> Result<Vec<T>, UnboundedRecvError>
pub async fn drain_at_least_one(&self) -> Result<Vec<T>, UnboundedRecvError>
Asynchronously wait for at least 1 value to show up, then will greedily try to receive values until this receiver would block. The resulting values are returned.
It is guaranteed that the returning vec contains at least 1 value
§Errors
Will return an error if there was an error retrieving the first value.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for UnboundedReceiver<T>
impl<T> RefUnwindSafe for UnboundedReceiver<T>
impl<T> Send for UnboundedReceiver<T>where
T: Send,
impl<T> Sync for UnboundedReceiver<T>where
T: Send,
impl<T> Unpin for UnboundedReceiver<T>
impl<T> UnwindSafe for UnboundedReceiver<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