Struct UnboundedSender

pub struct UnboundedSender<T>(/* private field */);

The transmission end of an unbounded mpsc channel.

This value is created by the unbounded function.

Implementations

impl<T> UnboundedSender<T>

fn poll_ready(&self, &mut Context<'_>) -> Poll<Result<(), SendError>>

Check if the channel is ready to receive a message.

fn is_closed(&self) -> bool

Returns whether this channel is closed without needing a context.

fn close_channel(&self)

Closes this channel from the sender side, preventing any new messages.

fn disconnect(&mut self)

Disconnects this sender from the channel, closing it if there are no more senders left.

fn start_send(&mut self, msg: T) -> Result<(), SendError>

Send a message on the channel.

This method should only be called after poll_ready has been used to verify that the channel is ready to receive a message.

fn unbounded_send(&self, msg: T) -> Result<(), TrySendError<T>>

Sends a message along this channel.

This is an unbounded sender, so this function differs from Sink::send by ensuring the return type reflects that the channel is always ready to receive messages.

fn same_receiver(&self, other: &Self) -> bool

Returns whether the senders send to the same receiver.

fn is_connected_to(&self, receiver: &UnboundedReceiver<T>) -> bool

Returns whether the sender send to this receiver.

fn hash_receiver<H>(&self, hasher: &mut H)
where
    H: Hasher,

Hashes the receiver into the provided hasher

fn len(&self) -> usize

Return the number of messages in the queue or 0 if channel is disconnected.

fn is_empty(&self) -> bool

Return false is channel has no queued messages, true otherwise.

Trait Implementations

impl<T> Clone for UnboundedSender<T>

fn clone(&self) -> Self

impl<T> Debug for UnboundedSender<T>

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

impl<T> Sink<T> for UnboundedSender<T>

type Error = SendError;
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, msg: T) -> Result<(), Self::Error>
fn poll_flush(self: Pin<&mut Self>, &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_close(self: Pin<&mut Self>, &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Auto Trait Implementations

impl<T> !RefUnwindSafe for UnboundedSender<T>

impl<T> !UnwindSafe for UnboundedSender<T>

impl<T> Freeze for UnboundedSender<T> where Option<UnboundedSenderInner<T>>: Freeze,

impl<T> Send for UnboundedSender<T> where Option<UnboundedSenderInner<T>>: Send,

impl<T> Sync for UnboundedSender<T> where Option<UnboundedSenderInner<T>>: Sync,

impl<T> Unpin for UnboundedSender<T> where Option<UnboundedSenderInner<T>>: Unpin,

impl<T> UnsafeUnpin for UnboundedSender<T> where Option<UnboundedSenderInner<T>>: UnsafeUnpin,

Blanket Implementations

impl<T> Any for UnboundedSender<T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for UnboundedSender<T> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for UnboundedSender<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for UnboundedSender<T> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for UnboundedSender<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 UnboundedSender<T> where U: Into<T>,

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

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

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