pub struct Sender<T> { /* private fields */ }
Expand description
The transmission end of a channel which is used to send values.
This is created by the channel
method.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn try_send(&mut self, msg: T) -> Result<(), TrySendError<T>>
pub fn try_send(&mut self, msg: T) -> Result<(), TrySendError<T>>
Attempts to send a message on this Sender<T>
without blocking.
This function, unlike start_send
, is safe to call whether it’s being
called on a task or not. Note that this function, however, will not
attempt to block the current task if the message cannot be sent.
It is not recommended to call this function from inside of a future, only from an external thread where you’ve otherwise arranged to be notified when the channel is no longer full.
Sourcepub fn poll_ready(&mut self) -> Poll<(), SendError<()>>
pub fn poll_ready(&mut self) -> Poll<(), SendError<()>>
Polls the channel to determine if there is guaranteed to be capacity to send at least one item without waiting.
Returns Ok(Async::Ready(_))
if there is sufficient capacity, or returns
Ok(Async::NotReady)
if the channel is not guaranteed to have capacity. Returns
Err(SendError(_))
if the receiver has been dropped.
§Panics
This method will panic if called from outside the context of a task or future.
Trait Implementations§
Source§impl<T> Sink for Sender<T>
impl<T> Sink for Sender<T>
Source§fn start_send(&mut self, msg: T) -> StartSend<T, SendError<T>>
fn start_send(&mut self, msg: T) -> StartSend<T, SendError<T>>
Source§fn poll_complete(&mut self) -> Poll<(), SendError<T>>
fn poll_complete(&mut self) -> Poll<(), SendError<T>>
Source§fn close(&mut self) -> Poll<(), SendError<T>>
fn close(&mut self) -> Poll<(), SendError<T>>
Source§fn wait(self) -> Wait<Self>where
Self: Sized,
fn wait(self) -> Wait<Self>where
Self: Sized,
Source§fn with<U, F, Fut>(self, f: F) -> With<Self, U, F, Fut>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
fn with<U, F, Fut>(self, f: F) -> With<Self, U, F, Fut>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
Source§fn with_flat_map<U, F, St>(self, f: F) -> WithFlatMap<Self, U, F, St>
fn with_flat_map<U, F, St>(self, f: F) -> WithFlatMap<Self, U, F, St>
Source§fn sink_map_err<F, E>(self, f: F) -> SinkMapErr<Self, F>
fn sink_map_err<F, E>(self, f: F) -> SinkMapErr<Self, F>
Source§fn sink_from_err<E>(self) -> SinkFromErr<Self, E>
fn sink_from_err<E>(self) -> SinkFromErr<Self, E>
From
for this sink’s
Error
, returning a new sink. Read moreSource§fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
Source§fn flush(self) -> Flush<Self>where
Self: Sized,
fn flush(self) -> Flush<Self>where
Self: Sized,
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> !RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>where
T: Send,
impl<T> Sync for Sender<T>where
T: Send,
impl<T> Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)