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 sender half
This prevents any further messages from being sent on the channel while still enabling the receiver to drain messages that are buffered.
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns whether this channel is closed without needing a context.
sourcepub fn downgrade(self) -> WeakSender<T>
pub fn downgrade(self) -> WeakSender<T>
Returns downgraded sender
Trait Implementations§
source§impl<T> Sink<T> for Sender<T>
impl<T> Sink<T> for Sender<T>
source§fn poll_ready(
self: Pin<&mut Sender<T>>,
_: &mut Context<'_>
) -> Poll<Result<(), <Sender<T> as Sink<T>>::Error>>
fn poll_ready( self: Pin<&mut Sender<T>>, _: &mut Context<'_> ) -> Poll<Result<(), <Sender<T> as Sink<T>>::Error>>
Attempts to prepare the
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Sender<T>>, item: T) -> Result<(), SendError<T>>
fn start_send(self: Pin<&mut Sender<T>>, item: T) -> Result<(), SendError<T>>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read moreimpl<T> Unpin for Sender<T>
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> !RefUnwindSafe for Sender<T>
impl<T> !Send for Sender<T>
impl<T> !Sync for Sender<T>
impl<T> !UnwindSafe 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