Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(&self, payload: Value) -> Result<Value, ZynkError>;
}
Expand description

Type-erased endpoint handler contract used by server bindings.

Required Methods§

Source

fn call(&self, payload: Value) -> Result<Value, ZynkError>

Invoke the handler with a JSON object payload and return a JSON value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> Handler for F
where F: Fn(Value) -> Result<Value, ZynkError> + Send + Sync + 'static,