A very small and very fast JSON-RPC 2.0 server-focused framework.
Provides an integration for actix-web
servers.
```rust use jsonrpc_v2::*;
struct TwoNums { a: usize, b: usize }
fn add(Params(params): Params
fn sub(Params(params): Params<(usize, usize)>) -> Result
fn message(state: State
fn main() -> Result<(), Box
let rpc = Server::with_state(String::from("Hello!"))
.with_method("add", add)
.with_method("sub", sub)
.with_method("message", message)
.finish();
actix_web::HttpServer::new(move || {
let rpc = rpc.clone();
actix_web::App::new().service(
actix_web::web::service("/api")
.guard(actix_web::guard::Post())
.finish(rpc.into_web_service()),
)
})
.bind("0.0.0.0:3000")?
.run()?;
Ok(())
} ```
License: MIT