s_jsonrpc_core/
lib.rs

1//! ### Transport agnostic jsonrpc library.
2//!
3//! Right now it supports only server side handling requests.
4//!
5//! ```rust
6//! extern crate s_jsonrpc_core;
7//!
8//! use s_jsonrpc_core::*;
9//! use s_jsonrpc_core::futures::Future;
10//!
11//! fn main() {
12//! 	let mut io = IoHandler::new();
13//! 	io.add_msod("say_hello", |_| {
14//!			Ok(Value::String("Hello World!".into()))
15//! 	});
16//!
17//! 	let request = r#"{"jsonrpc": "2.0", "msod": "say_hello", "params": [42, 23], "id": 1}"#;
18//! 	let response = r#"{"jsonrpc":"2.0","result":"Hello World!","id":1}"#;
19//!
20//! 	assert_eq!(io.handle_request(request).wait().unwrap(), Some(response.to_string()));
21//! }
22//! ```
23
24#![warn(missing_docs)]
25
26#[macro_use] extern crate log;
27#[macro_use] extern crate serde_derive;
28extern crate serde;
29
30pub extern crate futures;
31
32#[doc(hidden)]
33pub extern crate serde_json;
34
35mod calls;
36mod io;
37
38mod middleware;
39pub mod types;
40
41/// A `Future` trait object.
42pub type BoxFuture<T> = Box<futures::Future<Item = T, Error = Error> + Send>;
43
44/// A Result type.
45pub type Result<T> = ::std::result::Result<T, Error>;
46
47pub use calls::{RemoteProcedure, Metadata, RpcMsodSimple, RpcMsod, RpcNotificationSimple, RpcNotification};
48pub use io::{Compatibility, IoHandler, MetaIoHandler, FutureResponse, FutureResult};
49pub use middleware::{Middleware, Noop as NoopMiddleware};
50pub use types::*;