Show the crate…
3 stable releases
15.1.0 | Mar 13, 2021 |
---|---|
14.2.1 | Mar 1, 2021 |
#17 in #server-builder
69KB
1.5K
SLoC
tetsy-jsonrpc-stdio-server
STDIN/STDOUT server for JSON-RPC 2.0. Takes one request per line and outputs each response on a new line.
Example
Cargo.toml
[dependencies]
tetsy-jsonrpc-stdio-server = "14.2"
main.rs
use tetsy_jsonrpc_stdio_server::ServerBuilder;
use tetsy_jsonrpc_stdio_server::tetsy_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 tetsy_jsonrpc_stdio_server::ServerBuilder;
use tetsy_jsonrpc_stdio_server::tetsy_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