1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! High level, typed wrapper for `jsonrpc_core`.
//!
//! Enables creation of "Service" objects grouping a set of RPC methods together in a typed manner.
//!
//! Example
//!
//! ```
//! extern crate jsonrpc_core;
//! #[macro_use] extern crate jsonrpc_macros;
//! use jsonrpc_core::{IoHandler, Error};
//! use jsonrpc_core::futures::{self, BoxFuture, Future};
//! build_rpc_trait! {
//! 	pub trait Rpc {
//! 		/// Returns a protocol version
//! 		#[rpc(name = "protocolVersion")]
//! 		fn protocol_version(&self) -> Result<String, Error>;
//!
//! 		/// Adds two numbers and returns a result
//! 		#[rpc(name = "add")]
//! 		fn add(&self, u64, u64) -> Result<u64, Error>;
//!
//! 		/// Performs asynchronous operation
//! 		#[rpc(async, name = "callAsync")]
//! 		fn call(&self, u64) -> BoxFuture<String, Error>;
//! 	}
//! }
//! struct RpcImpl;
//! impl Rpc for RpcImpl {
//! 	fn protocol_version(&self) -> Result<String, Error> {
//! 		Ok("version1".into())
//! 	}
//!
//! 	fn add(&self, a: u64, b: u64) -> Result<u64, Error> {
//! 		Ok(a + b)
//! 	}
//!
//! 	fn call(&self, _: u64) -> BoxFuture<String, Error> {
//! 		futures::finished("OK".to_owned()).boxed()
//! 	}
//! }
//!
//! fn main() {
//!	  let mut io = IoHandler::new();
//!	  let rpc = RpcImpl;
//!
//!	  io.extend_with(rpc.to_delegate());
//! }
//! ```

#![warn(missing_docs)]

pub extern crate jsonrpc_core;
extern crate jsonrpc_pubsub;
extern crate serde;

mod auto_args;
mod delegates;
mod util;

pub mod pubsub;

#[doc(hidden)]
pub use auto_args::{Wrap, WrapAsync, WrapMeta, WrapSubscribe};
pub use auto_args::Trailing;
pub use delegates::IoDelegate;
pub use util::to_value;