Struct Sender

pub struct Sender { /* private fields */ }

Sender of the simplex channel.

Cancellation safety

The Sender is cancel safe. If it is used as the event in a tokio::select! statement and some other branch completes first, it is guaranteed that no bytes were sent on this channel.

Shutdown

See Sender::poll_shutdown.

Trait Implementations

impl AsyncWrite for Sender

fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize, Error>>

Errors

This method will return IoErrorKind::BrokenPipe if the channel has been closed.

fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Error>>

Errors

This method will return IoErrorKind::BrokenPipe if the channel has been closed.

fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Error>>

After returns Poll::Ready, all the following call to Sender::poll_write and Sender::poll_flush will return error.

The Receiver can still be used to read remaining data until all bytes have been consumed.

fn is_write_vectored(&self) -> bool
fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize, IoError>>

impl Debug for Sender

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

impl Drop for Sender

fn drop(&mut self)

This also wakes up the Receiver.

Auto Trait Implementations

impl Freeze for Sender

impl RefUnwindSafe for Sender

impl Send for Sender

impl Sync for Sender

impl Unpin for Sender

impl UnsafeUnpin for Sender

impl UnwindSafe for Sender

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Sender

fn from(t: T) -> T

Returns the argument unchanged.

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

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

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

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

impl<W> AsyncWriteExt for Sender where W: AsyncWrite + ?Sized,