Struct futures_channel::mpsc::Receiver
source · [−]pub struct Receiver<T> { /* private fields */ }
Expand description
The receiving end of a bounded mpsc channel.
This value is created by the channel
function.
Implementations
sourceimpl<T> Receiver<T>
impl<T> Receiver<T>
sourcepub fn close(&mut self)
pub fn close(&mut self)
Closes the receiving half of a channel, without dropping it.
This prevents any further messages from being sent on the channel while still enabling the receiver to drain messages that are buffered.
sourcepub fn try_next(&mut self) -> Result<Option<T>, TryRecvError>
pub fn try_next(&mut self) -> Result<Option<T>, TryRecvError>
Tries to receive the next message without notifying a context if empty.
It is not recommended to call this function from inside of a future, only when you’ve otherwise arranged to be notified when the channel is no longer empty.
This function returns:
Ok(Some(t))
when message is fetchedOk(None)
when channel is closed and no messages left in the queueErr(e)
when there are no messages available, but channel is not yet closed
Trait Implementations
sourceimpl<T> FusedStream for Receiver<T>
impl<T> FusedStream for Receiver<T>
sourcefn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns true
if the stream should no longer be polled.
sourceimpl<T> Stream for Receiver<T>
impl<T> Stream for Receiver<T>
type Item = T
type Item = T
Values yielded by the stream.
impl<T> Unpin for Receiver<T>
Auto Trait Implementations
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> !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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more