jsonrpce 0.1.0

JSON-RPC 2.0 for Rust
Documentation
# jsonrpc

JSON-RPC 2.0 implementation for Rust.

## Features

- **Transport Agnostic**: Decouples protocol logic from I/O. Comes with `Stdio`
  and `InMemory` transports out of the box.
- **Type-Safe Handlers**: Handlers are just Rust functions. Parameters are
  automatically deserialized, and results are serialized.

## Demo

Let's build a simple calculator server over `Stdio`:

```rust
use serde::Deserialize;
use jsonrpc::{Error, Server};

#[derive(Deserialize)]
struct AddParams {
    a: i32,
    b: i32,
}

fn add(_: &(), params: AddParams) -> Result<i32, Error> {
    Ok(params.a + params.b)
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    Server::stdio(()).method("add", add).run()?;
    Ok(())
}
```

Compile and run it, then pipe in some JSON-RPC commands:

```sh
echo '{"jsonrpc": "2.0", "method": "add", "params": {"a": 10, "b": 20}, "id": 1}' | cargo run --example stdio
```

Output:

```json
{ "jsonrpc": "2.0", "result": 30, "id": 1 }
```

## Installation

TODO: add installation via git

## Usage

TODO: add usage

## License

MIT