Trait ump_ng_server::task::Handler
source · pub trait Handler<P, S, R, E, RV> {
// Required methods
fn post<'life0, 'async_trait>(
&'life0 mut self,
msg: P
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn req<'life0, 'async_trait>(
&'life0 mut self,
msg: S,
rctx: ReplyContext<R, E>
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn init(&mut self, weak_client: WeakClient<P, S, R, E>) { ... }
fn term(&mut self, rv: Option<RV>) -> Option<RV> { ... }
}Available on crate feature
tokio only.Required Methods§
sourcefn post<'life0, 'async_trait>(
&'life0 mut self,
msg: P
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn post<'life0, 'async_trait>(
&'life0 mut self,
msg: P
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Put 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 task.
sourcefn req<'life0, 'async_trait>(
&'life0 mut self,
msg: S,
rctx: ReplyContext<R, E>
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn req<'life0, 'async_trait>(
&'life0 mut self,
msg: S,
rctx: ReplyContext<R, E>
) -> Pin<Box<dyn Future<Output = ControlFlow<RV, ()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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 task.
Provided Methods§
sourcefn init(&mut self, weak_client: WeakClient<P, S, R, E>)
fn init(&mut self, weak_client: WeakClient<P, S, R, E>)
Optional initialization callback.
This is called on the dispatcher task before the main message processing loop is entered.