pub trait Handler<M: Message>: Service {
type Response: ResponseHandler<Self, M>;
// Required method
fn handle(
&mut self,
msg: M,
ctx: &mut ServiceContext<Self>,
) -> Self::Response;
}
Expand description
Handler implementation for allowing a service to handle a specific message type
Required Associated Types§
Sourcetype Response: ResponseHandler<Self, M>
type Response: ResponseHandler<Self, M>
The response type this handler will use
Required Methods§
Sourcefn handle(&mut self, msg: M, ctx: &mut ServiceContext<Self>) -> Self::Response
fn handle(&mut self, msg: M, ctx: &mut ServiceContext<Self>) -> Self::Response
Handler for processing the message using the current service context and message. Will respond with the specified response type
self
The service handling the message
msg
The message that is being handled
ctx
Mutable borrow of the service context
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.