5 releases (stable)

✓ Uses Rust 2018 edition

11.0.0 Apr 5, 2019
10.1.0 Feb 13, 2019
10.0.1 Jan 31, 2019
0.1.0 Nov 5, 2018

40 downloads per month

MIT license

56KB
1.5K 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 = "11.0"

main.rs

use jsonrpc_stdio_server::server;
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::*;

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

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

Dependencies

~2.5MB
~53K SLoC