Struct actix::prelude::Recipient

source ·
pub struct Recipient<M>
where M: Message + Send, M::Result: Send,
{ /* private fields */ }
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§

source§

impl<M> Recipient<M>
where M: Message + Send, M::Result: Send,

source

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.

source

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.

source

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.

source

pub fn connected(&self) -> bool

source

pub fn downgrade(&self) -> WeakRecipient<M>

Returns a downgraded WeakRecipient

Trait Implementations§

source§

impl<M> Clone for Recipient<M>
where M: Message + Send, M::Result: Send,

source§

fn clone(&self) -> Recipient<M>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<M> Debug for Recipient<M>
where M: Message + Send, M::Result: Send,

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A, M: Message + Send + 'static> From<Addr<A>> for Recipient<M>
where A: Handler<M> + Actor, M::Result: Send, A::Context: ToEnvelope<A, M>,

source§

fn from(addr: Addr<A>) -> Self

Converts to this type from the input type.
source§

impl<M> From<Recipient<M>> for WeakRecipient<M>
where M: Message + Send, M::Result: Send,

source§

fn from(recipient: Recipient<M>) -> Self

Converts to this type from the input type.
source§

impl<M> Hash for Recipient<M>
where M: Message + Send, M::Result: Send,

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<M> PartialEq for Recipient<M>
where M: Message + Send, M::Result: Send,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<M> Eq for Recipient<M>
where M: Message + Send, M::Result: Send,

Auto Trait Implementations§

§

impl<M> Freeze for Recipient<M>

§

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.