pub struct Sender<T> { /* private fields */ }
Expand description
Send values to the associated Receiver
.
Instances are created by the channel
function.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn poll_ready(&mut self) -> Poll<(), SendError>
pub fn poll_ready(&mut self) -> Poll<(), SendError>
Check if the Sender
is ready to handle a value.
Polls the channel to determine if there is guaranteed capacity to send at least one item without waiting.
When poll_ready
returns Ready
, the channel reserves capacity for one
message for this Sender
instance. The capacity is held until a message
is send or the Sender
instance is dropped. Callers should ensure a
message is sent in a timely fashion in order to not starve other
Sender
instances.
§Return value
This method returns:
Ok(Async::Ready(_))
if capacity is reserved for a single message.Ok(Async::NotReady)
if the channel may not have capacity, in which case the current task is queued to be notified once capacity is available;Err(SendError)
if the receiver has been dropped.
Sourcepub fn try_send(&mut self, message: T) -> Result<(), TrySendError<T>>
pub fn try_send(&mut self, message: T) -> Result<(), TrySendError<T>>
Attempts to send a message on this Sender
, returning the message
if there was an error.
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, Self::SinkError>
fn start_send(&mut self, msg: T) -> StartSend<T, Self::SinkError>
Begin the process of sending a value to the sink. Read more
Source§fn poll_complete(&mut self) -> Poll<(), Self::SinkError>
fn poll_complete(&mut self) -> Poll<(), Self::SinkError>
Flush all output from this sink, if necessary. Read more
Source§fn close(&mut self) -> Poll<(), Self::SinkError>
fn close(&mut self) -> Poll<(), Self::SinkError>
A method to indicate that no more values will ever be pushed into this
sink. Read more
Source§fn wait(self) -> Wait<Self>where
Self: Sized,
fn wait(self) -> Wait<Self>where
Self: Sized,
Creates a new object which will produce a synchronous sink. Read more
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,
Composes a function in front of the sink. Read more
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>
Composes a function in front of the sink. Read more
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>
Transforms the error returned by the sink.
Source§fn sink_from_err<E>(self) -> SinkFromErr<Self, E>
fn sink_from_err<E>(self) -> SinkFromErr<Self, E>
Map this sink’s error to any error implementing
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,
Adds a fixed-size buffer to the current sink. Read more
Source§fn flush(self) -> Flush<Self>where
Self: Sized,
fn flush(self) -> Flush<Self>where
Self: Sized,
A future that completes when the sink has finished processing all
pending requests. Read more
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)