Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(
        &self,
        cx: &CallContext,
        method: &str,
        params: &Value,
        emit: &Emit,
    ) -> Result<Value, ServiceError>;

    // Provided methods
    fn on_handoff(&self) { ... }
    fn connection_closed(&self, _conn: u64) { ... }
}

Required Methods§

Source

fn call( &self, cx: &CallContext, method: &str, params: &Value, emit: &Emit, ) -> Result<Value, ServiceError>

Serve one allowlisted request. Events go to emit; a returned retryable error is sent to the client as-is.

Provided Methods§

Source

fn on_handoff(&self)

A takeover was accepted: stop starting new steps, finish at a boundary.

Source

fn connection_closed(&self, _conn: u64)

A connection closed (also fired mid-request when the peer drops).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§