pub trait Message<T: Send + 'static>: Actor {
type Reply: Send + 'static;
// Required method
fn handle(
&mut self,
msg: T,
actor_ref: &ActorRef<Self>,
) -> impl Future<Output = Self::Reply> + Send;
}Expand description
Required Associated Types§
Required Methods§
Sourcefn handle(
&mut self,
msg: T,
actor_ref: &ActorRef<Self>,
) -> impl Future<Output = Self::Reply> + Send
fn handle( &mut self, msg: T, actor_ref: &ActorRef<Self>, ) -> impl Future<Output = Self::Reply> + Send
Handles the incoming message and produces a reply.
The actor_ref parameter is a reference to the actor’s own ActorRef.
This is an asynchronous method where the actor’s business logic for
processing the message T resides.
This method is called by the actor system when a message is received via
tell, ask,
or their variants.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.