alux-jsonrpc
alux-jsonrpc describes typed JSON-RPC method programs independently of an RPC framework.
The crate is a specification. It carries no interpreter and depends only on
alux-ext: a JSON-RPC surface is described here as first-order syntax
plus the capability algebras an interpreter must witness. Domain specifications provide their own
capability traits and compose defunctionalized operations.
use ;
use ;
use Future;
/// A downstream specification owns its primitive domain meaning.
/// Derived operations become first-order values that preserve their argument names.
/// The method program is declared before any framework is chosen.
;
// The same program is constructible directly, without the convenience macro and without an
// interpreter, because a method program is an ordinary value.
let builder = JsonRpcProgramBuilder;
let program = builder
.methods
.method
.into_program;
let _merged = builder.methods.merge.into_program;
// Named decoding means these argument names, carried from the authored method.
assert_eq!;
Positional parameters are the default. .named() decodes a JSON object using the argument names
retained by alux-ext.
alux-jsonrpc-jsonrpsee compiles the same program into
jsonrpsee Methods.