Skip to main content

RpcInterceptor

Trait RpcInterceptor 

Source
pub trait RpcInterceptor:
    Send
    + Sync
    + 'static {
    // Required method
    fn before_call(
        &self,
        method: &str,
        params: &Option<Value>,
    ) -> Result<(), RpcError>;
}
Expand description

Pluggable interceptor invoked before each JSON-RPC 2.0 method dispatch.

Required Methods§

Source

fn before_call( &self, method: &str, params: &Option<Value>, ) -> Result<(), RpcError>

Inspects or rejects an incoming JSON-RPC call before its method handler runs.

§Arguments
  • &str - Target JSON-RPC method name.
  • &Option<Value> - Optional method parameters.
§Returns
  • Result<(), RpcError> - Ok(()) to continue dispatch, or Err(RpcError) to short-circuit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§