diff --git a/core/src/lib.rs b/core/src/lib.rs index 2bcdfadca..5f293ce92 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -30,6 +30,8 @@ pub use futures; #[doc(hidden)] pub extern crate serde_json; +#[doc(hidden)] +pub extern crate serde; mod calls; mod io; diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 48c71e94b..8fe096eb8 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -9,7 +9,7 @@ //! use jsonrpc_core::{IoHandler, Error, Result}; //! use jsonrpc_core::futures::future::{self, FutureResult}; //! -//! #[rpc] +//! #[rpc(server)] //! pub trait Rpc { //! #[rpc(name = "protocolVersion")] //! fn protocol_version(&self) -> Result; diff --git a/derive/src/rpc_trait.rs b/derive/src/rpc_trait.rs index cf0076252..30516d68a 100644 --- a/derive/src/rpc_trait.rs +++ b/derive/src/rpc_trait.rs @@ -236,7 +236,6 @@ pub fn rpc_impl(input: syn::Item, options: DeriveOptions) -> Result Result $DIR/attr-invalid-meta-list-names.rs:8:2 - | -8 | /// Returns a protocol version - | _____^ -9 | | #[rpc(name = "protocolVersion", Xalias("alias"))] -10 | | fn protocol_version(&self) -> Result; - | |_________________________________________________^ + --> $DIR/attr-invalid-meta-list-names.rs:7:2 + | +7 | /// Returns a protocol version + | _____^ +8 | | #[rpc(name = "protocolVersion", Xalias("alias"))] +9 | | fn protocol_version(&self) -> Result; + | |_________________________________________________^ diff --git a/derive/tests/ui/attr-invalid-meta-words.rs b/derive/tests/ui/attr-invalid-meta-words.rs index 6149f7118..106df1baa 100644 --- a/derive/tests/ui/attr-invalid-meta-words.rs +++ b/derive/tests/ui/attr-invalid-meta-words.rs @@ -1,4 +1,3 @@ -extern crate serde; extern crate jsonrpc_core; #[macro_use] extern crate jsonrpc_derive; diff --git a/derive/tests/ui/attr-invalid-meta-words.stderr b/derive/tests/ui/attr-invalid-meta-words.stderr index c4a310ae7..8b1c99051 100644 --- a/derive/tests/ui/attr-invalid-meta-words.stderr +++ b/derive/tests/ui/attr-invalid-meta-words.stderr @@ -1,8 +1,8 @@ error: Invalid attribute parameter(s): 'Xmeta'. Expected 'meta, raw_params' - --> $DIR/attr-invalid-meta-words.rs:8:2 - | -8 | /// Returns a protocol version - | _____^ -9 | | #[rpc(name = "protocolVersion", Xmeta)] -10 | | fn protocol_version(&self) -> Result; - | |_________________________________________________^ + --> $DIR/attr-invalid-meta-words.rs:7:2 + | +7 | /// Returns a protocol version + | _____^ +8 | | #[rpc(name = "protocolVersion", Xmeta)] +9 | | fn protocol_version(&self) -> Result; + | |_________________________________________________^ diff --git a/derive/tests/ui/attr-invalid-name-values.rs b/derive/tests/ui/attr-invalid-name-values.rs index 3c4cf7a12..4a3fa4acf 100644 --- a/derive/tests/ui/attr-invalid-name-values.rs +++ b/derive/tests/ui/attr-invalid-name-values.rs @@ -1,4 +1,3 @@ -extern crate serde; extern crate jsonrpc_core; #[macro_use] extern crate jsonrpc_derive; diff --git a/derive/tests/ui/attr-invalid-name-values.stderr b/derive/tests/ui/attr-invalid-name-values.stderr index aebdba62e..69a56cc44 100644 --- a/derive/tests/ui/attr-invalid-name-values.stderr +++ b/derive/tests/ui/attr-invalid-name-values.stderr @@ -1,8 +1,8 @@ error: Invalid attribute parameter(s): 'Xname'. Expected 'name, returns' - --> $DIR/attr-invalid-name-values.rs:8:2 - | -8 | /// Returns a protocol version - | _____^ -9 | | #[rpc(Xname = "protocolVersion")] -10 | | fn protocol_version(&self) -> Result; - | |_________________________________________________^ + --> $DIR/attr-invalid-name-values.rs:7:2 + | +7 | /// Returns a protocol version + | _____^ +8 | | #[rpc(Xname = "protocolVersion")] +9 | | fn protocol_version(&self) -> Result; + | |_________________________________________________^ diff --git a/derive/tests/ui/attr-missing-rpc-name.rs b/derive/tests/ui/attr-missing-rpc-name.rs index 53b76991a..401359af4 100644 --- a/derive/tests/ui/attr-missing-rpc-name.rs +++ b/derive/tests/ui/attr-missing-rpc-name.rs @@ -1,4 +1,3 @@ -extern crate serde; extern crate jsonrpc_core; #[macro_use] extern crate jsonrpc_derive; diff --git a/derive/tests/ui/attr-missing-rpc-name.stderr b/derive/tests/ui/attr-missing-rpc-name.stderr index d2287b7d0..788008029 100644 --- a/derive/tests/ui/attr-missing-rpc-name.stderr +++ b/derive/tests/ui/attr-missing-rpc-name.stderr @@ -1,8 +1,8 @@ error: rpc attribute should have a name e.g. `name = "method_name"` - --> $DIR/attr-missing-rpc-name.rs:8:2 - | -8 | /// Returns a protocol version - | _____^ -9 | | #[rpc] -10 | | fn protocol_version(&self) -> Result; - | |_________________________________________________^ + --> $DIR/attr-missing-rpc-name.rs:7:2 + | +7 | /// Returns a protocol version + | _____^ +8 | | #[rpc] +9 | | fn protocol_version(&self) -> Result; + | |_________________________________________________^ diff --git a/derive/tests/ui/multiple-rpc-attributes.rs b/derive/tests/ui/multiple-rpc-attributes.rs index 01bf8adad..7a48b3c0c 100644 --- a/derive/tests/ui/multiple-rpc-attributes.rs +++ b/derive/tests/ui/multiple-rpc-attributes.rs @@ -1,4 +1,3 @@ -extern crate serde; extern crate jsonrpc_core; #[macro_use] extern crate jsonrpc_derive; diff --git a/derive/tests/ui/multiple-rpc-attributes.stderr b/derive/tests/ui/multiple-rpc-attributes.stderr index 6204f119a..28ce7cbef 100644 --- a/derive/tests/ui/multiple-rpc-attributes.stderr +++ b/derive/tests/ui/multiple-rpc-attributes.stderr @@ -1,9 +1,9 @@ error: Expected only a single rpc attribute per method - --> $DIR/multiple-rpc-attributes.rs:8:2 + --> $DIR/multiple-rpc-attributes.rs:7:2 | -8 | /// Returns a protocol version +7 | /// Returns a protocol version | _____^ -9 | | #[rpc(name = "protocolVersion")] -10 | | #[rpc(name = "protocolVersionAgain")] -11 | | fn protocol_version(&self) -> Result; +8 | | #[rpc(name = "protocolVersion")] +9 | | #[rpc(name = "protocolVersionAgain")] +10 | | fn protocol_version(&self) -> Result; | |_________________________________________________^ diff --git a/derive/tests/ui/too-many-params.rs b/derive/tests/ui/too-many-params.rs index 14c7d07be..7e217c22a 100644 --- a/derive/tests/ui/too-many-params.rs +++ b/derive/tests/ui/too-many-params.rs @@ -1,4 +1,3 @@ -extern crate serde; extern crate jsonrpc_core; #[macro_use] extern crate jsonrpc_derive; diff --git a/derive/tests/ui/too-many-params.stderr b/derive/tests/ui/too-many-params.stderr index 3ae24d7f1..25e04b856 100644 --- a/derive/tests/ui/too-many-params.stderr +++ b/derive/tests/ui/too-many-params.stderr @@ -1,12 +1,12 @@ error: Maximum supported number of params is 16 - --> $DIR/too-many-params.rs:8:2 + --> $DIR/too-many-params.rs:7:2 | -8 | /// Has too many params +7 | /// Has too many params | _____^ -9 | | #[rpc(name = "tooManyParams")] -10 | | fn to_many_params( -11 | | &self, -12 | | a: u64, b: u64, c: u64, d: u64, e: u64, f: u64, g: u64, h: u64, i: u64, j: u64, -13 | | k: u64, l: u64, m: u64, n: u64, o: u64, p: u64, q: u64, -14 | | ) -> Result; +8 | | #[rpc(name = "tooManyParams")] +9 | | fn to_many_params( +10 | | &self, +11 | | a: u64, b: u64, c: u64, d: u64, e: u64, f: u64, g: u64, h: u64, i: u64, j: u64, +12 | | k: u64, l: u64, m: u64, n: u64, o: u64, p: u64, q: u64, +13 | | ) -> Result; | |________________________^