21 stable releases (8 major)

17.0.0 Jan 20, 2021
16.0.0 Dec 14, 2020
15.1.0 Sep 30, 2020
14.2.0 Jun 3, 2020
0.1.0 Nov 5, 2018
Download history 71/week @ 2021-01-16 159/week @ 2021-01-23 40/week @ 2021-01-30 74/week @ 2021-02-06 191/week @ 2021-02-13 76/week @ 2021-02-20 103/week @ 2021-02-27 171/week @ 2021-03-06 78/week @ 2021-03-13 175/week @ 2021-03-20 127/week @ 2021-03-27 119/week @ 2021-04-03 123/week @ 2021-04-10 148/week @ 2021-04-17 58/week @ 2021-04-24 116/week @ 2021-05-01

339 downloads per month
Used in 3 crates

MIT license

66KB
2K SLoC

jsonrpc-stdio-server

STDIN/STDOUT server for JSON-RPC 2.0. Takes one request per line and outputs each response on a new line.

Documentation

Example

Cargo.toml

[dependencies]
jsonrpc-stdio-server = "15.0"

main.rs

use jsonrpc_stdio_server::ServerBuilder;
use jsonrpc_stdio_server::jsonrpc_core::*;

fn main() {
	let mut io = IoHandler::default();
	io.add_method("say_hello", |_params| {
		Ok(Value::String("hello".to_owned()))
	});

	ServerBuilder::new(io).build();
}

lib.rs:

jsonrpc server using stdin/stdout


use jsonrpc_stdio_server::ServerBuilder;
use jsonrpc_stdio_server::jsonrpc_core::*;

#[tokio::main]
async fn main() {
	let mut io = IoHandler::default();
	io.add_sync_method("say_hello", |_params| {
		Ok(Value::String("hello".to_owned()))
	});

	let server = ServerBuilder::new(io).build();
   	server.await;
}

Dependencies

~5.5MB
~97K SLoC