Expand description
The Recipient
type allows to send one specific message to an actor.
You can get a recipient using the Addr::recipient()
method. It is possible
to use the Clone::clone()
method to get a cloned recipient.
Implementations
sourceimpl<M> Recipient<M> where
M: Message + Send,
M::Result: Send,
impl<M> Recipient<M> where
M: Message + Send,
M::Result: Send,
sourcepub fn do_send(&self, msg: M)
pub fn do_send(&self, msg: M)
Sends a message.
The message is always queued, even if the mailbox for the receiver is full. If the mailbox is closed, the message is silently dropped.
sourcepub fn try_send(&self, msg: M) -> Result<(), SendError<M>>
pub fn try_send(&self, msg: M) -> Result<(), SendError<M>>
Attempts to send a message.
This method fails if the actor’s mailbox is full or closed. This method registers the current task in the receivers queue.
sourcepub fn send(&self, msg: M) -> RecipientRequest<M>
pub fn send(&self, msg: M) -> RecipientRequest<M>
Sends a message and asynchronously wait for a response.
The communication channel to the actor is bounded. If the returned RecipientRequest
object
gets dropped, the message is cancelled.
pub fn connected(&self) -> bool
sourcepub fn downgrade(&self) -> WeakRecipient<M>
pub fn downgrade(&self) -> WeakRecipient<M>
Returns a downgraded WeakRecipient
Trait Implementations
sourceimpl<A: Actor, M: Message + Send + 'static> From<Addr<A>> for Recipient<M> where
A: Handler<M>,
M::Result: Send,
A::Context: ToEnvelope<A, M>,
impl<A: Actor, M: Message + Send + 'static> From<Addr<A>> for Recipient<M> where
A: Handler<M>,
M::Result: Send,
A::Context: ToEnvelope<A, M>,
impl<M> Eq for Recipient<M> where
M: Message + Send,
M::Result: Send,
Auto Trait Implementations
impl<M> !RefUnwindSafe for Recipient<M>
impl<M> Send for Recipient<M>
impl<M> Sync for Recipient<M>
impl<M> Unpin for Recipient<M>
impl<M> !UnwindSafe for Recipient<M>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more