rama::service::handler

Trait Factory

pub trait Factory<T, R, O, E>:
    Send
    + Sync
    + 'static
where R: Future<Output = Result<O, E>>,
{ // Required method fn call(&self, param: T) -> R; }
Expand description

Async handler converter factory

Required Methods§

fn call(&self, param: T) -> R

Call the handler function with the given parameter.

Implementors§

§

impl<F, R, O, E> Factory<(), R, O, E> for F
where F: Fn() -> R + Send + Sync + 'static, R: Future<Output = Result<O, E>>,

§

impl<Request, F, R, O, E> Factory<((), Request), R, O, E> for F
where F: Fn(Request) -> R + Send + Sync + 'static, R: Future<Output = Result<O, E>>,

§

impl<State, Request, F, R, O, E> Factory<(Context<State>, Request), R, O, E> for F
where F: Fn(Context<State>, Request) -> R + Send + Sync + 'static, R: Future<Output = Result<O, E>>,