Struct UnboundedReceiver

pub struct UnboundedReceiver<T> { /* private fields */ }

The receiving end of an unbounded mpsc channel.

This value is created by the unbounded function.

Implementations

impl<T> UnboundedReceiver<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 fetched
  • Ok(None) when channel is closed and no messages left in the queue
  • Err(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 UnboundedReceiver<T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T> Drop for UnboundedReceiver<T>

fn drop(&mut self)

impl<T> FusedStream for UnboundedReceiver<T>

fn is_terminated(&self) -> bool

impl<T> Stream for UnboundedReceiver<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 UnboundedReceiver<T>

Auto Trait Implementations

impl<T> !RefUnwindSafe for UnboundedReceiver<T>

impl<T> !UnwindSafe for UnboundedReceiver<T>

impl<T> Freeze for UnboundedReceiver<T> where Option<Arc<UnboundedInner<T>>>: Freeze,

impl<T> Send for UnboundedReceiver<T> where Option<Arc<UnboundedInner<T>>>: Send,

impl<T> Sync for UnboundedReceiver<T> where Option<Arc<UnboundedInner<T>>>: Sync,

impl<T> UnsafeUnpin for UnboundedReceiver<T> where Option<Arc<UnboundedInner<T>>>: UnsafeUnpin,

Blanket Implementations

impl<S, T, E> TryStream for UnboundedReceiver<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 UnboundedReceiver<T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for UnboundedReceiver<T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for UnboundedReceiver<T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for UnboundedReceiver<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for UnboundedReceiver<T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for UnboundedReceiver<T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for UnboundedReceiver<T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>