pub struct Sender<T> { /* private fields */ }
Expand description
Sends values to the associated Receiver
.
Instances are created by the channel
function.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn broadcast(&mut self, value: T) -> Result<(), SendError<T>>
pub fn broadcast(&mut self, value: T) -> Result<(), SendError<T>>
Broadcast a new value via the channel, notifying all receivers.
Sourcepub fn poll_close(&mut self) -> Poll<(), ()>
pub fn poll_close(&mut self) -> Poll<(), ()>
Returns Ready
when all receivers have dropped.
This allows the producer to get notified when interest in the produced values is canceled and immediately stop doing work.
Trait Implementations§
Source§impl<T> Sink for Sender<T>
impl<T> Sink for Sender<T>
Source§fn start_send(&mut self, item: T) -> StartSend<T, SendError<T>>
fn start_send(&mut self, item: T) -> StartSend<T, SendError<T>>
Begin the process of sending a value to the sink. Read more
Source§fn poll_complete(&mut self) -> Poll<(), SendError<T>>
fn poll_complete(&mut self) -> Poll<(), SendError<T>>
Flush all output from this sink, if necessary. Read more
Source§fn close(&mut self) -> Result<Async<()>, Self::SinkError>
fn close(&mut self) -> Result<Async<()>, 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>
impl<T> Sync for Sender<T>
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