pub struct Addr<A: Actor> { /* private fields */ }
Expand description
The address of an actor.
Implementations
sourceimpl<A: Actor> Addr<A>
impl<A: Actor> Addr<A>
pub fn new(tx: AddressSender<A>) -> Addr<A>
sourcepub fn do_send<M>(&self, msg: M) where
M: Message + Send,
M::Result: Send,
A: Handler<M>,
A::Context: ToEnvelope<A, M>,
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.
sourcepub 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>,
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.
sourcepub 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>,
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.
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>,
sourceimpl<A: Actor, M: Message + Send + 'static> From<Addr<A>> for WeakRecipient<M> where
A: Handler<M>,
M::Result: Send,
A::Context: ToEnvelope<A, M>,
impl<A: Actor, M: Message + Send + 'static> From<Addr<A>> for WeakRecipient<M> where
A: Handler<M>,
M::Result: Send,
A::Context: ToEnvelope<A, M>,
sourcefn from(addr: Addr<A>) -> WeakRecipient<M>
fn from(addr: Addr<A>) -> WeakRecipient<M>
Performs the conversion.
sourceimpl<A, M, B> MessageResponse<A, M> for Addr<B> where
A: Actor,
M: Message<Result = Self>,
B: Actor,
impl<A, M, B> MessageResponse<A, M> for Addr<B> where
A: Actor,
M: Message<Result = Self>,
B: Actor,
fn handle(self, _: &mut A::Context, tx: Option<OneshotSender<Self>>)
impl<A: Actor> Eq for Addr<A>
Auto Trait Implementations
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
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