Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing Clone and Copy impls #951

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/http-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]

//! # jsonrpsee-http-client
//!
//! `jsonrpsee-http-client` is [JSON RPC](https://www.jsonrpc.org/specification) HTTP client library that's is built for `async/await`.
Expand All @@ -34,6 +32,9 @@
//! which is not compatible with other async runtimes such as
//! [`async-std`](https://docs.rs/async-std/), [`smol`](https://docs.rs/smol) and similar.

#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

mod client;

/// HTTP transport.
Expand Down
7 changes: 4 additions & 3 deletions client/wasm-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]
#![cfg(target_arch = "wasm32")]

//! # jsonrpsee-wasm-client

#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg(target_arch = "wasm32")]

pub use jsonrpsee_core::client::Client;
pub use jsonrpsee_types as types;

Expand Down
5 changes: 3 additions & 2 deletions client/ws-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]

//! # jsonrpsee-ws-client
//!
//! `jsonrpsee-ws-client` is a [JSON RPC](https://www.jsonrpc.org/specification) WebSocket client library that's is built for `async/await`.
Expand All @@ -34,6 +32,9 @@
//!
//! This library uses `tokio` as the runtime and does not support other runtimes.

#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[cfg(test)]
mod tests;

Expand Down
2 changes: 1 addition & 1 deletion core/src/client/async_client/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use jsonrpsee_types::{
use serde_json::Value as JsonValue;
use std::ops::Range;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub(crate) struct InnerBatchResponse {
pub(crate) id: u64,
pub(crate) result: Result<JsonValue, ErrorObject<'static>>,
Expand Down
2 changes: 1 addition & 1 deletion core/src/client/async_client/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum Kind {
Subscription((RequestId, SubscriptionSink, UnsubscribeMethod)),
}

#[derive(Debug)]
#[derive(Debug, Clone)]
/// Indicates the status of a given request/response.
pub(crate) enum RequestStatus {
/// The method call is waiting for a response,
Expand Down
2 changes: 1 addition & 1 deletion core/src/client/async_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl ErrorFromBack {
}

/// Builder for [`Client`].
#[derive(Clone, Debug)]
#[derive(Debug, Copy, Clone)]
pub struct ClientBuilder {
request_timeout: Duration,
max_concurrent_requests: usize,
Expand Down
4 changes: 2 additions & 2 deletions core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub trait TransportSenderT: MaybeSend + 'static {

/// Message type received from the RPC server.
/// It can either be plain text data, bytes, or `Pong` messages.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum ReceivedMessage {
/// Incoming packet contains plain `String` data.
Text(String),
Expand Down Expand Up @@ -498,7 +498,7 @@ pub fn generate_batch_id_range(guard: &RequestIdGuard<Id>, len: u64) -> Result<R
pub type BatchEntry<'a, R> = Result<R, ErrorObject<'a>>;

/// Batch response.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct BatchResponse<'a, R> {
successful_calls: usize,
failed_calls: usize,
Expand Down
6 changes: 3 additions & 3 deletions core/src/id_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::traits::IdProvider;
use jsonrpsee_types::SubscriptionId;

/// Generates random integers as subscription ID.
#[derive(Debug, Clone)]
#[derive(Debug, Copy, Clone)]
pub struct RandomIntegerIdProvider;

impl IdProvider for RandomIntegerIdProvider {
Expand All @@ -44,7 +44,7 @@ impl IdProvider for RandomIntegerIdProvider {
}

/// Generates random strings of length `len` as subscription ID.
#[derive(Debug, Clone)]
#[derive(Debug, Copy, Clone)]
pub struct RandomStringIdProvider {
len: usize,
}
Expand All @@ -64,7 +64,7 @@ impl IdProvider for RandomStringIdProvider {
}

/// No-op implementation to be used for servers that don't support subscriptions.
#[derive(Debug, Clone)]
#[derive(Debug, Copy, Clone)]
pub struct NoopIdProvider;

impl IdProvider for NoopIdProvider {
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

//! Shared utilities for `jsonrpsee`.

#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]
#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

// Macros useful internally within this crate, but not to be exposed outside of it.
Expand Down
6 changes: 3 additions & 3 deletions core/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mod params_builder {
/// 1. Other serialization methods than `serde_json::to_writer` would internally
/// have an extra heap allocation for temporarily holding the value in memory.
/// 2. `io::Write` is not implemented for `String` required for serialization.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub(crate) struct ParamsBuilder {
bytes: Vec<u8>,
start: char,
Expand Down Expand Up @@ -141,7 +141,7 @@ mod params_builder {
///
/// // Use RPC parameters...
/// ```
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct ObjectParams(params_builder::ParamsBuilder);

impl ObjectParams {
Expand Down Expand Up @@ -188,7 +188,7 @@ impl ToRpcParams for ObjectParams {
///
/// // Use RPC parameters...
/// ```
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct ArrayParams(params_builder::ParamsBuilder);

impl ArrayParams {
Expand Down
8 changes: 4 additions & 4 deletions core/src/server/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use tokio::sync::{Notify, OwnedSemaphorePermit, Semaphore};
/// (&mut writer).write("hello".as_bytes()).unwrap();
/// assert_eq!(std::str::from_utf8(&writer.into_bytes()).unwrap(), "hello");
/// ```
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct BoundedWriter {
max_len: usize,
buf: Vec<u8>,
Expand Down Expand Up @@ -214,7 +214,7 @@ impl BoundedSubscriptions {
}

/// Represent the response to method call.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct MethodResponse {
/// Serialized JSON-RPC response,
pub result: String,
Expand Down Expand Up @@ -260,7 +260,7 @@ impl MethodResponse {
}

/// Builder to build a `BatchResponse`.
#[derive(Debug, Default)]
#[derive(Debug, Clone, Default)]
pub struct BatchResponseBuilder {
/// Serialized JSON-RPC response,
result: String,
Expand Down Expand Up @@ -313,7 +313,7 @@ impl BatchResponseBuilder {
}

/// Response to a batch request.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct BatchResponse {
/// Formatted JSON-RPC response.
pub result: String,
Expand Down
2 changes: 1 addition & 1 deletion core/src/server/rpc_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub struct ConnState<'a> {
}

/// Outcome of a successful terminated subscription.
#[derive(Debug)]
#[derive(Debug, Copy, Clone)]
pub enum InnerSubscriptionResult {
/// The subscription stream was executed successfully.
Success,
Expand Down
1 change: 1 addition & 0 deletions jsonrpsee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
//! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS.
//! - **`client-web-transport`** - Enables `websys` transport.

#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

// Macros useful below, but not to be exposed outside of the crate.
Expand Down
5 changes: 3 additions & 2 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]

//! # jsonrpsee-server
//!
//! `jsonrpsee-server` is a [JSON RPC](https://www.jsonrpc.org/specification) server that supports both HTTP and WebSocket transport.

#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

mod future;
mod server;
mod transport;
Expand Down
2 changes: 1 addition & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ pub(crate) struct ServiceData<L: Logger> {
///
/// # Note
/// This is similar to [`hyper::service::service_fn`].
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct TowerService<L: Logger> {
inner: ServiceData<L>,
}
Expand Down
4 changes: 2 additions & 2 deletions types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub type SubscriptionResult = Result<(), SubscriptionEmptyError>;
///
/// It contains no data, and neither is the error utilized. It provides an abstraction to make the
/// API more ergonomic while handling errors that may occur during the subscription callback.
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct SubscriptionEmptyError;

impl From<anyhow::Error> for SubscriptionEmptyError {
Expand Down Expand Up @@ -116,7 +116,7 @@ impl From<SubscriptionAcceptRejectError> for SubscriptionEmptyError {
}

/// The error returned while accepting or rejecting a subscription.
#[derive(Debug)]
#[derive(Debug, Copy, Clone)]
pub enum SubscriptionAcceptRejectError {
/// The method was already called.
AlreadyCalled,
Expand Down
5 changes: 3 additions & 2 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

//! Shared types in `jsonrpsee` for clients, servers and utilities.
//! JSON-RPC specific types.

#![warn(missing_docs, missing_debug_implementations)]
#![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

extern crate alloc;

Expand Down
2 changes: 1 addition & 1 deletion types/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<'a> Params<'a> {
/// params parsing (often) yields values of different types.
///
/// Regards empty array `[]` as no parameters provided.
#[derive(Debug)]
#[derive(Debug, Copy, Clone)]
pub struct ParamsSequence<'a>(&'a str);

impl<'a> ParamsSequence<'a> {
Expand Down