minirpc
MINI-RPC is a stateless, light-weight remote procedure call (RPC) protocol. Inspired by the JSON-RPC 2.0 Specification, this implementation written in Rust selected its essential parts in order to keep as minimal as possible the communication between processes.
Examples
Syntax:
--> data sent to Server
<-- data sent to Client
Basic Usage
--> {"id":1,"method":"sum","params":[1,2,3]}
<-- {"id":1,"result":6}
use *;
use *;
// --> Request.
let input = r#"{"id":1,"method":"sum","params":[1,2,3]}"#;
let expected = Single;
let result: Request = from_str.unwrap;
assert_eq!;
// <-- Response.
let input = r#"{"id":1,"result":6}"#;
let expected = Single;
let result: Response = from_str.unwrap;
assert_eq!;
Batch Notification
--> [{"method":"log","params":{"level":"info"}},{"method":"log","params":{"level":"warn"}}]
// --> Batch Request.
let input = r#"[{"method":"log","params":{"level":"info"}},{"method":"log","params":{"level":"warn"}}]"#;
let mut params_1 = new;
params_1.insert;
let mut params_2 = new;
params_2.insert;
let expected = Batch;
let result: Request = from_str.unwrap;
assert_eq!;