pub struct Sender<T> { /* private fields */ }Expand description
The transmission end of a channel.
This is created by the channel function.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn send(&self, item: T) -> Result<(), SendError<T>>
pub fn send(&self, item: T) -> Result<(), SendError<T>>
Sends the provided message along this channel.
Sourcepub fn close(&self)
pub fn close(&self)
Closes the channel for every sender.
This prevents any further messages from being sent on the channel, by this sender or any of its clones, while still enabling the receiver to drain messages that are buffered.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true if the channel is closed or the receiver has been dropped.
Sourcepub fn poll_closed(&self, cx: &mut Context<'_>) -> Poll<()>
pub fn poll_closed(&self, cx: &mut Context<'_>) -> Poll<()>
Polls whether the channel is closed or the receiver has been dropped.
Only the task from the most recent call is woken, across this sender and all of its clones.
Sourcepub async fn closed(&self)
pub async fn closed(&self)
Waits until the channel is closed or the receiver has been dropped.
See poll_closed.
Trait Implementations§
impl<T> Unpin for Sender<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Sender<T>
impl<T> !Send for Sender<T>
impl<T> !Sync for Sender<T>
impl<T> !UnwindSafe for Sender<T>
impl<T> Freeze for Sender<T>
impl<T> UnsafeUnpin for Sender<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more