Skip to main content

IntoTypedHandler

Trait IntoTypedHandler 

Source
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§

Source

type Future: Future<Output = Result<Handled, HandlerError>> + Send + 'static

Required Methods§

Source

fn call(&self, msg: T, ctx: MessageContext) -> Self::Future

Implementors§

Source§

impl<F, Fut, T> IntoTypedHandler<T, (T, MessageContext)> for F
where T: DeserializeOwned + Send + Sync + 'static, F: Fn(T, MessageContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Handled, HandlerError>> + Send + 'static,

Source§

type Future = Fut

Source§

impl<F, Fut, T> IntoTypedHandler<T, (T,)> for F
where T: DeserializeOwned + Send + Sync + 'static, F: Fn(T) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Handled, HandlerError>> + Send + 'static,

Source§

type Future = Fut