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§
Sourcefn call(
&self,
cx: &CallContext,
method: &str,
params: &Value,
emit: &Emit,
) -> Result<Value, ServiceError>
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§
Sourcefn on_handoff(&self)
fn on_handoff(&self)
A takeover was accepted: stop starting new steps, finish at a boundary.
Sourcefn connection_closed(&self, _conn: u64)
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".