pub struct ActorRef<A>{ /* private fields */ }Expand description
Implementations§
Source§impl<A> ActorRef<A>
impl<A> ActorRef<A>
pub const fn new( path: ActorPath, sender: HandleHelper<A>, stop_sender: Sender<Option<Sender<()>>>, event_receiver: EventReceiver<<A as Actor>::Event>, ) -> Self
Sourcepub async fn tell(&self, message: A::Message) -> Result<(), Error>
pub async fn tell(&self, message: A::Message) -> Result<(), Error>
Sends a message to the actor without waiting for a response (fire-and-forget).
Sourcepub async fn ask(&self, message: A::Message) -> Result<A::Response, Error>
pub async fn ask(&self, message: A::Message) -> Result<A::Response, Error>
Sends message to the actor and waits for a response.
Returns the actor’s response on success, or an error if the actor has stopped or the message channel is full.
Sourcepub async fn ask_timeout(
&self,
message: A::Message,
timeout: Duration,
) -> Result<A::Response, Error>
pub async fn ask_timeout( &self, message: A::Message, timeout: Duration, ) -> Result<A::Response, Error>
Sends message and waits up to timeout for a response, returning Error::Timeout if the deadline is exceeded.
Sourcepub async fn ask_stop(&self) -> Result<(), Error>
pub async fn ask_stop(&self) -> Result<(), Error>
Requests the actor to stop gracefully and waits for it to confirm shutdown.
The actor will finish its current message, run pre_stop and post_stop,
and stop its children before terminating. Returns an error if the actor has
already stopped.
Sourcepub async fn tell_stop(&self)
pub async fn tell_stop(&self)
Sends a stop signal without waiting for the actor to confirm shutdown (fire-and-forget).
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for ActorRef<A>
impl<A> RefUnwindSafe for ActorRef<A>
impl<A> Send for ActorRef<A>
impl<A> Sync for ActorRef<A>
impl<A> Unpin for ActorRef<A>
impl<A> UnsafeUnpin for ActorRef<A>
impl<A> UnwindSafe for ActorRef<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