Struct actix::Addr

source ·
pub struct Addr<A: Actor> { /* private fields */ }
Expand description

The address of an actor.

Implementations§

source§

impl<A: Actor> Addr<A>

source

pub fn new(tx: AddressSender<A>) -> Addr<A>

source

pub fn connected(&self) -> bool

Returns whether the actor is still alive.

source

pub fn do_send<M>(&self, msg: M)
where M: Message + Send, M::Result: Send, A: Handler<M>, A::Context: ToEnvelope<A, M>,

Sends a message unconditionally, ignoring any potential errors.

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<M>(&self, msg: M) -> Result<(), SendError<M>>
where M: Message + Send + 'static, M::Result: Send, A: Handler<M>, A::Context: ToEnvelope<A, M>,

Tries to send a message.

This method fails if actor’s mailbox is full or closed. This method registers the current task in the receiver’s queue.

source

pub fn send<M>(&self, msg: M) -> Request<A, M>
where M: Message + Send + 'static, M::Result: Send, A: Handler<M>, A::Context: ToEnvelope<A, M>,

Sends an asynchronous message and waits for a response.

The communication channel to the actor is bounded. If the returned request future gets dropped, the message is cancelled.

source

pub fn recipient<M>(self) -> Recipient<M>
where A: Handler<M>, A::Context: ToEnvelope<A, M>, M: Message + Send + 'static, M::Result: Send,

Returns the Recipient for a specific message type.

source

pub fn downgrade(&self) -> WeakAddr<A>

Returns a downgraded WeakAddr.

Trait Implementations§

source§

impl<A: Actor> Clone for Addr<A>

source§

fn clone(&self) -> Addr<A>

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<A: Actor> Debug for Addr<A>

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<A, M: Message + Send + 'static> From<Addr<A>> for WeakRecipient<M>
where A: Handler<M> + Actor, M::Result: Send, A::Context: ToEnvelope<A, M>,

source§

fn from(addr: Addr<A>) -> WeakRecipient<M>

Converts to this type from the input type.
source§

impl<A: Actor> Hash for Addr<A>

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<A, M, B> MessageResponse<A, M> for Addr<B>
where A: Actor, M: Message<Result = Self>, B: Actor,

source§

fn handle(self, _: &mut A::Context, tx: Option<OneshotSender<Self>>)

source§

impl<A: Actor> PartialEq for Addr<A>

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<A: Actor> Eq for Addr<A>

Auto Trait Implementations§

§

impl<A> Freeze for Addr<A>

§

impl<A> !RefUnwindSafe for Addr<A>

§

impl<A> Send for Addr<A>

§

impl<A> Sync for Addr<A>

§

impl<A> Unpin for Addr<A>

§

impl<A> !UnwindSafe for Addr<A>

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.