pub trait AsyncHandler<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 'life0: 'async_trait,
Self: '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 'life0: 'async_trait,
Self: 'async_trait;
// 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 an async handler.
Required Methods§
Sourcefn post<'life0, 'async_trait>(
&'life0 mut self,
msg: P,
) -> Pin<Box<dyn Future<Output = ControlFlow<RV>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn post<'life0, 'async_trait>(
&'life0 mut self,
msg: P,
) -> Pin<Box<dyn Future<Output = ControlFlow<RV>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: '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.