Struct Sender

struct Sender<T>(_)

The transmission end of a bounded mpsc channel.

This value is created by the channel function.

Implementations

impl<T> Sender<T>

fn try_send(self: &mut Self, msg: T) -> Result<(), TrySendError<T>>

Attempts to send a message on this Sender, returning the message if there was an error.

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

Send a message on the channel.

This function should only be called after poll_ready has reported that the channel is ready to receive a message.

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

Polls the channel to determine if there is guaranteed capacity to send at least one item without waiting.

Return value

This method returns:

  • Poll::Ready(Ok(_)) if there is sufficient capacity;
  • Poll::Pending if the channel may not have capacity, in which case the current task is queued to be notified once capacity is available;
  • Poll::Ready(Err(SendError)) if the receiver has been dropped.
fn is_closed(self: &Self) -> bool

Returns whether this channel is closed without needing a context.

fn close_channel(self: &mut Self)

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

fn disconnect(self: &mut Self)

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

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

Returns whether the senders send to the same receiver.

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

Returns whether the sender send to this receiver.

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

Hashes the receiver into the provided hasher

impl<T> Any for Sender<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Sender<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Sender<T>

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

impl<T> Clone for Sender<T>

fn clone(self: &Self) -> Self

impl<T> CloneToUninit for Sender<T>

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

impl<T> Debug for Sender<T>

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

impl<T> Freeze for Sender<T>

impl<T> From for Sender<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Sender<T>

impl<T> Send for Sender<T>

impl<T> Sink for Sender<T>

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

impl<T> Sync for Sender<T>

impl<T> ToOwned for Sender<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for Sender<T>

impl<T> UnsafeUnpin for Sender<T>

impl<T> UnwindSafe for Sender<T>

impl<T, U> Into for Sender<T>

fn into(self: 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 for Sender<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Sender<T>

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