Skip to main content

Handler

Trait Handler 

Source
pub trait Handler: Send + Sync {
    // Required method
    fn call(
        &self,
        args: &str,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>;
}
Expand description

Handler trait for protocol-agnostic request handling

Handlers implement this trait to provide a unified interface that can be called from any protocol adapter.

Required Methods§

Source

fn call( &self, args: &str, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>

Call the handler with JSON args and return a result

Implementors§

Source§

impl<F, Fut> Handler for HandlerFn<F, Fut>
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = String> + Send + 'static,

Source§

impl<F, S, Fut> Handler for HandlerWithStateOnly<F, S, Fut>
where F: Fn(State<Arc<S>>) -> Fut + Send + Sync + 'static, S: Send + Sync + 'static, Fut: Future<Output = String> + Send + 'static,

Source§

impl<F, S, T, Fut> Handler for HandlerWithState<F, S, T, Fut>
where F: Fn(State<Arc<S>>, T) -> Fut + Send + Sync + 'static, S: Send + Sync + 'static, T: DeserializeOwned + Send + 'static, Fut: Future<Output = String> + Send + 'static,

Source§

impl<F, T, Fut> Handler for HandlerWithArgs<F, T, Fut>
where F: Fn(T) -> Fut + Send + Sync + 'static, T: DeserializeOwned + Send + 'static, Fut: Future<Output = String> + Send + 'static,