pub struct Address<A: Actor> { /* private fields */ }Implementations§
Source§impl<A: Actor> Address<A>
impl<A: Actor> Address<A>
pub async fn send<M: Message + 'static>(
&self,
message: M,
) -> Result<M::Result, ActorSendError>where
A: Handler<M>,
Sourcepub async fn send_unpack<M: Message + 'static, R>(
&self,
message: M,
) -> Result<R, ActorSendError>
pub async fn send_unpack<M: Message + 'static, R>( &self, message: M, ) -> Result<R, ActorSendError>
Sends a message and unpacks the result
Simplifies operations with some common kinds of results. Unpacks:
tokio::oneshot::Receiver<T>intoTResult<tokio::oneshot::Receiver<Result<T, E>, E>intoResult<T, E>
It could be useful when you need to return Receiver<T> from handler
immediately unblocking actors message loop to send T later.
Sourcepub fn downgrade(&self) -> WeakAddress<A>
pub fn downgrade(&self) -> WeakAddress<A>
Converts the Address to a [WeakAddress] that does not count
towards RAII semantics, i.e. if all Address instances of the
actor were dropped and only WeakAddress instances remain,
the actor is stopped.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true if actor is steel receiving messages.
The opposite of is_closed
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Address<A>
impl<A> RefUnwindSafe for Address<A>
impl<A> Send for Address<A>
impl<A> Sync for Address<A>
impl<A> Unpin for Address<A>
impl<A> UnwindSafe for Address<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more