Struct heph_inbox::Sender
source · [−]pub struct Sender<T> { /* private fields */ }
Expand description
Sending side of the channel.
Implementations
sourceimpl<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>ⓘNotable traits for SendValue<'s, T>impl<'s, T> Future for SendValue<'s, T> type Output = Result<(), T>;
pub fn send(&self, value: T) -> SendValue<'_, T>ⓘNotable traits for SendValue<'s, T>impl<'s, T> Future for SendValue<'s, T> type Output = Result<(), 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>ⓘNotable traits for Join<'s, T>impl<'s, T> Future for Join<'s, T> type Output = ();
pub fn join(&self) -> Join<'_, T>ⓘNotable traits for Join<'s, T>impl<'s, T> Future for Join<'s, T> type Output = ();
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
sourceimpl<T> Clone for Sender<T>
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: Send> Send for Sender<T>
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe 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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more