Skip to main content

JsonRpcMount

Trait JsonRpcMount 

Source
pub trait JsonRpcMount {
    // Required methods
    fn jsonrpc_mount_methods() -> Vec<String>;
    fn jsonrpc_mount_dispatch(
        &self,
        method: &str,
        params: Value,
    ) -> Result<Value, String>;
    fn jsonrpc_mount_dispatch_async(
        &self,
        method: &str,
        params: Value,
    ) -> impl Future<Output = Result<Value, String>> + Send;
}
Expand description

Trait for types that can be mounted as JSON-RPC method namespaces.

Implemented automatically by #[jsonrpc] on an impl block. Allows nested composition: a parent JSON-RPC server can mount a child’s methods with a dot-separated prefix.

Required Methods§

Source

fn jsonrpc_mount_methods() -> Vec<String>

Get method names for this mount (without prefix).

Source

fn jsonrpc_mount_dispatch( &self, method: &str, params: Value, ) -> Result<Value, String>

Dispatch a method call (sync). Returns error for async-only methods.

Source

fn jsonrpc_mount_dispatch_async( &self, method: &str, params: Value, ) -> impl Future<Output = Result<Value, String>> + Send

Dispatch a method call (async).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§