Trait actix::prelude::Handler
[−]
[src]
pub trait Handler<M, E = ()> where
Self: Actor,
M: ResponseType, { fn handle(&mut self, msg: M, ctx: &mut Self::Context) -> Response<Self, M>; fn error(&mut self, err: E, ctx: &mut Self::Context) { ... } }
Message handler
Handler
implementation is a general way how to handle
incoming messages, streams, futures.
M
is a message which can be handled by the actor.
E
is an optional error type, if message handler is used for handling
Future or Stream results, then E
type has to be set to correspondent Error
type.
Required Methods
fn handle(&mut self, msg: M, ctx: &mut Self::Context) -> Response<Self, M>
Method is called for every message received by this Actor
Provided Methods
fn error(&mut self, err: E, ctx: &mut Self::Context)
Method is called on error. By default it does nothing.
Implementors
impl Handler<StopArbiter> for Arbiter
impl<A> Handler<StartActor<A>> for Arbiter where
A: Actor<Context = Context<A>>,impl<I: Send, E: Send> Handler<Execute<I, E>> for Arbiter
impl Handler<SystemExit> for System