pub struct Receiver<T>(/* private fields */);
Expand description
A bounded receiver, created with [channel
]
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn into_stream(self) -> BoundedStream<T>where
T: 'static,
pub fn into_stream(self) -> BoundedStream<T>where
T: 'static,
Turn this recever into a stream. This may fail on some implementations if multiple references of a receiver exist
Sourcepub fn try_recv(&mut self) -> Result<T, TryRecvError>
pub fn try_recv(&mut self) -> Result<T, TryRecvError>
Try to receive a channel from the receiver. Will return immediately if there is no value available.
§Errors
Will return an error if the sender is dropped
Sourcepub async fn drain_at_least_one(&mut self) -> Result<Vec<T>, RecvError>
pub async fn drain_at_least_one(&mut self) -> Result<Vec<T>, RecvError>
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 the sender is dropped
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Receiver<T>
impl<T> RefUnwindSafe for Receiver<T>
impl<T> Send for Receiver<T>where
T: Send,
impl<T> Sync for Receiver<T>where
T: Send,
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