Struct Sender
pub struct Sender<T>(/* private field */);
The transmission end of a bounded mpsc channel.
This value is created by the channel function.
Implementations
impl<T> Sender<T>
fn try_send(&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(&mut self, msg: T) -> Result<(), SendError>Send a message on the channel.
This function should only be called after
poll_readyhas reported that the channel is ready to receive a message.fn poll_ready(&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::Pendingif 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) -> boolReturns whether this channel is closed without needing a context.
fn close_channel(&mut 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 same_receiver(&self, other: &Self) -> boolReturns whether the senders send to the same receiver.
fn is_connected_to(&self, receiver: &Receiver<T>) -> boolReturns 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
Trait Implementations
impl<T> Clone for Sender<T>
fn clone(&self) -> Self
impl<T> Debug for Sender<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Sink<T> for Sender<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>, cx: &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 Sender<T>
impl<T> !UnwindSafe for Sender<T>
impl<T> Freeze for Sender<T>
where
Option<BoundedSenderInner<T>>: Freeze,
impl<T> Send for Sender<T>
where
Option<BoundedSenderInner<T>>: Send,
impl<T> Sync for Sender<T>
where
Option<BoundedSenderInner<T>>: Sync,
impl<T> Unpin for Sender<T>
where
Option<BoundedSenderInner<T>>: Unpin,
impl<T> UnsafeUnpin for Sender<T>
where
Option<BoundedSenderInner<T>>: UnsafeUnpin,
Blanket Implementations
impl<T> Any for Sender<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Sender<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Sender<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Sender<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Sender<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Sender<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Sender<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 Sender<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Sender<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>