Struct Receiver
pub struct Receiver<T> { /* private fields */ }
The receiving end of a bounded mpsc channel.
This value is created by the channel function.
Implementations
impl<T> Receiver<T>
fn recv(&mut self) -> Recv<'_, Self>Waits for a message from the channel. If the channel is empty and closed, returns
RecvError.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.
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
fn try_recv(&mut self) -> Result<T, TryRecvError>Tries to receive a message from the channel without blocking. If the channel is empty, or empty and closed, this method returns an error.
Trait Implementations
impl<T> Debug for Receiver<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Drop for Receiver<T>
fn drop(&mut self)
impl<T> FusedStream for Receiver<T>
fn is_terminated(&self) -> bool
impl<T> Stream for Receiver<T>
type Item = T;fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<T>>fn size_hint(&self) -> (usize, Option<usize>)
impl<T> Unpin for Receiver<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
impl<T> Freeze for Receiver<T>
where
Option<Arc<BoundedInner<T>>>: Freeze,
impl<T> Send for Receiver<T>
where
Option<Arc<BoundedInner<T>>>: Send,
impl<T> Sync for Receiver<T>
where
Option<Arc<BoundedInner<T>>>: Sync,
impl<T> UnsafeUnpin for Receiver<T>
where
Option<Arc<BoundedInner<T>>>: UnsafeUnpin,
Blanket Implementations
impl<S, T, E> TryStream for Receiver<T>
where
S: Stream<Item = Result<T, E>> + ?Sized,
type Ok = T;type Error = E;fn try_poll_next(self: Pin<&mut S>, cx: &mut Context<'_>) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>
impl<T> Any for Receiver<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Receiver<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Receiver<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Receiver<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Receiver<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Receiver<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Receiver<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>