Struct theatre::prelude::Addr [−][src]
An Address to an Actor. Actor addresses allow for messages to be sent to actors.
A message must implement Message
and the actor that should receive it needs to implement
Handler<M>
where M
is the message type.
Addresses are parametrized over the Actor they point to. To obtain an address that is
parametrized over the message type call recipient()
.
Addresses keep actors running. Once all addresses are dropped the actor will stop. To obtain an
address to an actor without keeping it alive call downgrade()
to get a WeakAddr
(similar to
Arc & WeakArc).
Implementations
impl<A> Addr<A> where
A: Actor + Send,
[src]
A: Actor + Send,
pub async fn send<M>(&mut self, msg: M) -> Result<M::Return, TheatreError> where
A: Handler<M>,
M: Message + 'static,
[src]
A: Handler<M>,
M: Message + 'static,
Send a message and wait for the response. If the mailbox is full wait until there is capacity.
pub async fn try_send<M>(&mut self, msg: M) -> Result<M::Return, TheatreError> where
A: Handler<M>,
M: Message + 'static,
[src]
A: Handler<M>,
M: Message + 'static,
Try send a message and wait for the response. If the mailbox is full or dropped return an error.
pub fn try_send_and_forget<M>(&mut self, msg: M) -> Result<(), TheatreError> where
A: Handler<M>,
M: Message + 'static,
[src]
A: Handler<M>,
M: Message + 'static,
Try to send a message and discard the result. If the mailbox is full or dropped return an error.
pub fn recipient<M>(self) -> Recipient<M> where
A: Handler<M>,
M: 'static + Message,
[src]
A: Handler<M>,
M: 'static + Message,
Obtain a recipient to the actor.
pub fn downgrade(&self) -> WeakAddr<A>
[src]
Downgrade the address into a WeakAddr
Trait Implementations
impl<A> Clone for Addr<A> where
A: Actor,
[src]
A: Actor,
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A> Debug for Addr<A> where
A: Actor,
[src]
A: Actor,
impl<A> Drop for Addr<A> where
A: Actor,
[src]
A: Actor,
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,