pub trait Handler<P, S, R, E, RV> {
// Required methods
fn post(&mut self, msg: P) -> ControlFlow<RV>;
fn req(&mut self, msg: S, rctx: ReplyContext<R, E>) -> ControlFlow<RV>;
// Provided methods
fn init(&mut self, weak_client: Weak<P, S, R, E>) { ... }
fn term(&mut self, rv: Option<RV>) -> Option<RV> { ... }
}
Expand description
Message processing trait for a threaded handler.
Required Methods§
Sourcefn post(&mut self, msg: P) -> ControlFlow<RV>
fn post(&mut self, msg: P) -> ControlFlow<RV>
Post message processing callback.
The callback must return ControlFlow::Continue(())
to keep the
dispatcher loop going. Returning ControlFlow::Break(RV)
will cause the
dispatcher loop to abort and returns the value in RV
from the thread.
Sourcefn req(&mut self, msg: S, rctx: ReplyContext<R, E>) -> ControlFlow<RV>
fn req(&mut self, msg: S, rctx: ReplyContext<R, E>) -> ControlFlow<RV>
Request message processing callback.
The callback must return ControlFlow::Continue(())
to keep the
dispatcher loop going. Returning ControlFlow::Break(RV)
will cause the
dispatcher loop to abort and returns the value in RV
from the thread.