pub trait IntoTypedHandler<T, Args>:
Send
+ Sync
+ 'static {
type Future: Future<Output = Result<Handled, HandlerError>> + Send + 'static;
// Required method
fn call(&self, msg: T, ctx: MessageContext) -> Self::Future;
}Expand description
A helper trait to allow registering handlers with or without context.
Required Associated Types§
Required Methods§
fn call(&self, msg: T, ctx: MessageContext) -> Self::Future
Implementors§
Source§impl<F, Fut, T> IntoTypedHandler<T, (T, Result<Handled, ProcessingError>)> for F
Implementation for standard closures returning Result<Handled, HandlerError>.
This path is unique and allows correct inference for legacy code.
impl<F, Fut, T> IntoTypedHandler<T, (T, Result<Handled, ProcessingError>)> for F
Implementation for standard closures returning Result<Handled, HandlerError>. This path is unique and allows correct inference for legacy code.
Source§impl<F, Fut, T> IntoTypedHandler<T, (T, MessageContext, Result<Handled, ProcessingError>)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
F: Fn(T, MessageContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Handled, HandlerError>> + Send + 'static,
impl<F, Fut, T> IntoTypedHandler<T, (T, MessageContext, Result<Handled, ProcessingError>)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
F: Fn(T, MessageContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Handled, HandlerError>> + Send + 'static,
Source§impl<F, Fut, T, R> IntoTypedHandler<T, (T, MessageContext, R)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
R: ErgonomicResponse,
F: Fn(T, MessageContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = R> + Send + 'static,
impl<F, Fut, T, R> IntoTypedHandler<T, (T, MessageContext, R)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
R: ErgonomicResponse,
F: Fn(T, MessageContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = R> + Send + 'static,
Source§impl<F, Fut, T, R> IntoTypedHandler<T, (T, R)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
R: ErgonomicResponse,
F: Fn(T) -> Fut + Send + Sync + 'static,
Fut: Future<Output = R> + Send + 'static,
Ergonomic implementation for closures returning types that implement ErgonomicResponse.
impl<F, Fut, T, R> IntoTypedHandler<T, (T, R)> for Fwhere
T: DeserializeOwned + Send + Sync + 'static,
R: ErgonomicResponse,
F: Fn(T) -> Fut + Send + Sync + 'static,
Fut: Future<Output = R> + Send + 'static,
Ergonomic implementation for closures returning types that implement ErgonomicResponse.