jsonrpsee/
lib.rs

1// Copyright 2019-2021 Parity Technologies (UK) Ltd.
2//
3// Permission is hereby granted, free of charge, to any
4// person obtaining a copy of this software and associated
5// documentation files (the "Software"), to deal in the
6// Software without restriction, including without
7// limitation the rights to use, copy, modify, merge,
8// publish, distribute, sublicense, and/or sell copies of
9// the Software, and to permit persons to whom the Software
10// is furnished to do so, subject to the following
11// conditions:
12//
13// The above copyright notice and this permission notice
14// shall be included in all copies or substantial portions
15// of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27//! jsonrpsee wrapper crate.
28//!
29//! <br>
30//!
31//! # Optional features
32//!
33//! The `jsonrpsee` crate composes JSON-RPC functionality behind optional feature
34//! flags to provide for client and server communication over specific protocols.
35//! There are no default features, all functionality must be opted in to accordingly.
36//! The following features are available.
37//!
38//! - **`http-client`** - JSON-RPC client functionality over HTTP protocol.
39//! - **`wasm-client`** - JSON-RPC client functionality over web-sys.
40//! - **`ws-client`** - JSON-RPC client functionality over WebSocket protocol.
41//! - **`macros`** - JSON-RPC API generation convenience by derive macros.
42//! - **`client-core`** - Enables minimal client features to generate the RPC API without transports.
43//! - **`client`** - Enables all client features including transports.
44//! - **`server-core`** - Enables minimal server features to generate the RPC API without transports.
45//! - **`server`** - Enables all server features including transports.
46//! - **`full`** - Enables all features.
47//! - **`async-client`** - Enables the async client without any transport.
48//! - **`client-ws-transport`** - Enables `ws` transport with TLS.
49//! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS.
50//! - **`client-web-transport`** - Enables `websys` transport.
51
52#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
53#![cfg_attr(not(test), warn(unused_crate_dependencies))]
54#![cfg_attr(docsrs, feature(doc_cfg))]
55
56// Macros useful below, but not to be exposed outside of the crate.
57#[macro_use]
58mod macros;
59
60cfg_http_client! {
61	pub use jsonrpsee_http_client as http_client;
62}
63
64cfg_ws_client! {
65	pub use jsonrpsee_ws_client as ws_client;
66}
67
68cfg_wasm_client! {
69	pub use jsonrpsee_wasm_client as wasm_client;
70}
71
72cfg_async_client! {
73	pub use jsonrpsee_core::client::async_client;
74}
75
76cfg_client_transport! {
77	pub use jsonrpsee_client_transport as client_transport;
78}
79
80cfg_server! {
81	pub use jsonrpsee_server as server;
82	pub use tokio;
83}
84
85cfg_server_core! {
86	pub use jsonrpsee_core::server::*;
87}
88
89cfg_proc_macros! {
90	pub use jsonrpsee_proc_macros as proc_macros;
91	pub use tracing;
92}
93
94cfg_types! {
95	pub use jsonrpsee_types as types;
96}
97
98cfg_client_or_server! {
99	pub use jsonrpsee_core as core;
100}
101
102cfg_client! {
103	pub use jsonrpsee_core::rpc_params;
104}