#stdio

susy-jsonrpc-stdio-server

STDIN/STDOUT server for JSON-RPC

2 stable releases

10.1.0 Mar 25, 2019
10.0.1 Mar 25, 2019

#55 in #stdio

MIT license

58KB
1.5K SLoC

susy-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]
susy-jsonrpc-stdio-server = "10.0"

main.rs

use susy_jsonrpc_stdio_server::server;
use susy_jsonrpc_stdio_server::susy_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 susy_jsonrpc_stdio_server::ServerBuilder;
use susy_jsonrpc_stdio_server::susy_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

~5.5MB
~92K SLoC