Skip to main content

RpcMethod

Trait RpcMethod 

Source
pub trait RpcMethod {
    type Params: Serialize + DeserializeOwned + JsonSchema;
    type Result: Serialize + DeserializeOwned + JsonSchema;

    const NAME: &'static str;
    const SUMMARY: &'static str;
    const TAGS: &'static [&'static str] = _;
    const DEPRECATED: Option<&'static str> = None;

    // Provided methods
    fn param_schema() -> Schema { ... }
    fn result_schema() -> Schema { ... }
}
Expand description

Represents a JSON-RPC method with typed params and result.

Required Associated Constants§

Source

const NAME: &'static str

JSON-RPC method name.

Source

const SUMMARY: &'static str

Short summary for documentation.

Provided Associated Constants§

Source

const TAGS: &'static [&'static str] = _

Optional tags describing the method.

Source

const DEPRECATED: Option<&'static str> = None

Optional deprecation message.

Required Associated Types§

Source

type Params: Serialize + DeserializeOwned + JsonSchema

JSON-serializable params type.

Source

type Result: Serialize + DeserializeOwned + JsonSchema

JSON-serializable result type.

Provided Methods§

Source

fn param_schema() -> Schema

Generate JSON Schema for parameters.

Source

fn result_schema() -> Schema

Generate JSON Schema for result.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§