Skip to main content

Crate alux_jsonrpc_jsonrpsee

Crate alux_jsonrpc_jsonrpsee 

Source
Expand description

§alux-jsonrpc-jsonrpsee

alux-jsonrpc-jsonrpsee interprets an alux-jsonrpc program as a jsonrpsee method collection. The interpreter owns parameter decoding, method registration, context sharing, serialization, and boundary error conversion.

use alux_jsonrpc::JsonRpcProgramExt;
use alux_jsonrpc_jsonrpsee::JsonrpseeImpl;

let rpc = JsonrpseeImpl::new(App::new());
let methods = rpc.compile_jsonrpc(rpc.status_rpc::<App>())?;

A method marked fallible — with .fallible(), or by the fallible attribute on its ext — converts its error into a protocol error, so the interpreter needs RpcErrorAlg for that error and builds the ErrorObject itself. Every other method answers with any value serde can serialize.

RpcCtx carries a semantic context when a native #[rpc(server)] trait is implemented instead, and ResultToRpcExt and RpcErrorExt convert semantic errors at the boundary. A shared scenario in tests/ runs one expectation against both the specification-first program and a native jsonrpsee service.

Interprets typed JSON-RPC programs as jsonrpsee method collections.

The interpretation owns parameter decoding, method registration, context sharing, serialization, and boundary error conversion. Those are jsonrpsee mechanics rather than JSON-RPC program meaning, so the program compiled here is the same value any other interpreter folds.

Structs§

JsonrpseeImpl
Interprets typed JSON-RPC programs as jsonrpsee method collections.
RpcCtx
Carries a semantic context while interpreting it as a JSON-RPC service.

Traits§

IntoRpcMethodsExt
Provides fallible composition of independently declared JSON-RPC methods.
JsonrpseeArgs
Parses the parameter product consumed by a JSON-RPC operation.
ResultToRpcExt
Converts semantic results into JSON-RPC boundary results.
RpcErrorExt
Reads a domain failure as the JSON-RPC error it denotes.

Functions§

internal_rpc_error
Constructs an internal JSON-RPC error without implementation-specific data.
rpc_error
Constructs an owned JSON-RPC error.