pub struct Sender<T> { /* private fields */ }
Expand description
Sending side of the channel.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn try_send(&self, value: T) -> Result<(), SendError<T>>
pub fn try_send(&self, value: T) -> Result<(), SendError<T>>
Attempts to send the value
into the channel.
Sourcepub fn send(&self, value: T) -> SendValue<'_, T> ⓘ
pub fn send(&self, value: T) -> SendValue<'_, T> ⓘ
Returns a future that sends a value into the channel, waiting if the channel is full.
If the returned Future
returns an error it means the Receiver
and Manager
are disconnected and no more values will be read from
the channel. This is the same error as SendError::Disconnected
.
SendError::Full
will never be returned, the Future
will return
Poll::Pending
instead.
Sourcepub fn join(&self) -> Join<'_, T> ⓘ
pub fn join(&self) -> Join<'_, T> ⓘ
Returns a Future
that waits until the other side of the channel is
disconnected.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true
if the Receiver
and or the Manager
are connected.
§Notes
Unlike Receiver::is_connected
this method takes the Manager
into
account. This is done to support the use case in which an actor is
restarted and a new receiver is created for it.
Sourcepub fn has_manager(&self) -> bool
pub fn has_manager(&self) -> bool
Returns true
if the Manager
is connected.
Sourcepub fn same_channel(&self, other: &Sender<T>) -> bool
pub fn same_channel(&self, other: &Sender<T>) -> bool
Returns true
if senders send into the same channel.
Trait Implementations§
Source§impl<T> Clone for Sender<T>
§Safety
Only 2 ^ 30
(a billion) Sender
s may be alive concurrently, more then
enough for all practical use cases.
impl<T> Clone for Sender<T>
§Safety
Only 2 ^ 30
(a billion) Sender
s may be alive concurrently, more then
enough for all practical use cases.