pub struct Sender<T> { /* private fields */ }Expand description
The transmission end of a channel.
This is created by the channel function.
Implementations
sourceimpl<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
sourceimpl<T> Sink<T> for Sender<T>
impl<T> Sink<T> for Sender<T>
sourcefn poll_ready(
self: Pin<&mut Self>,
_: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
fn poll_ready(
self: Pin<&mut Self>,
_: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
Attempts to prepare the Sink to receive a value. Read more
sourcefn start_send(self: Pin<&mut Self>, item: T) -> Result<(), SendError<T>>
fn start_send(self: Pin<&mut Self>, 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 more
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>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more