Skip to content

Commit d23ffa3

Browse files
committed
cleanup
1 parent 59d847e commit d23ffa3

File tree

6 files changed

+11
-79
lines changed

6 files changed

+11
-79
lines changed

rpc/interface/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This crate simply handles:
3333
- Defining handler function signatures
3434
- (De)serialization of requests/responses (JSON-RPC, binary, JSON)
3535

36-
The actual server details are all handled by the [`axum`] and [`tower`] ecosystem.a
36+
The actual server details are all handled by the [`axum`] and [`tower`] ecosystem.
3737

3838
The proper usage of this crate is to:
3939
1. Implement a [`RpcHandler`]
@@ -45,8 +45,8 @@ The proper usage of this crate is to:
4545
This is your [`tower::Service`] that converts `Request`s into `Response`s,
4646
i.e. the "inner handler".
4747

48-
Said concretely, `RpcHandler` is 3 `tower::Service`s where the associated types are
49-
the 3 endpoint enums from [`cuprate_rpc_types`] and the error type from this crate:
48+
Said concretely, `RpcHandler` is 3 `tower::Service`s where the request/response types are
49+
the 3 endpoint enums from [`cuprate_rpc_types`] and the error type is from this crate:
5050
- [`JsonRpcRequest`](cuprate_rpc_types::json::JsonRpcRequest) & [`JsonRpcResponse`](cuprate_rpc_types::json::JsonRpcResponse)
5151
- [`BinRequest`](cuprate_rpc_types::bin::BinRequest) & [`BinResponse`](cuprate_rpc_types::bin::BinRequest)
5252
- [`OtherRequest`](cuprate_rpc_types::other::OtherRequest) & [`OtherResponse`](cuprate_rpc_types::other::OtherRequest)

rpc/interface/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ mod rpc_error;
77
mod rpc_handler;
88
#[cfg(feature = "dummy")]
99
mod rpc_handler_dummy;
10-
// mod rpc_request;
11-
// mod rpc_response;
1210
mod rpc_service;
1311

1412
pub use router_builder::RouterBuilder;
1513
pub use rpc_error::RpcError;
1614
pub use rpc_handler::RpcHandler;
1715
#[cfg(feature = "dummy")]
1816
pub use rpc_handler_dummy::RpcHandlerDummy;
19-
// pub use rpc_request::RpcRequest;
20-
// pub use rpc_response::RpcResponse;
2117
pub use rpc_service::RpcService;
2218

2319
// false-positive: used in `README.md`'s doc-test.

rpc/interface/src/rpc_handler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ use crate::RpcService;
1515
/// This trait represents a type that can turn `Request`s into `Response`s.
1616
///
1717
/// Implementors of this trait must be:
18-
/// - A [`tower::Service`]s that use [`JsonRpcRequest`] & [`JsonRpcResponse`]
19-
/// - A [`tower::Service`]s that use [`BinRequest`] & [`BinResponse`]
20-
/// - A [`tower::Service`]s that use [`OtherRequest`] & [`OtherResponse`]
18+
/// - A [`tower::Service`] that uses [`JsonRpcRequest`] & [`JsonRpcResponse`]
19+
/// - A [`tower::Service`] that uses [`BinRequest`] & [`BinResponse`]
20+
/// - A [`tower::Service`] that uses [`OtherRequest`] & [`OtherResponse`]
2121
///
2222
/// In other words, an [`RpcHandler`] is a type that implements [`tower::Service`] 3 times,
23-
/// one for each endpoint enum type found in [`cuprate_rpc_types`].
23+
/// one for each request/response enum type found in [`cuprate_rpc_types`].
2424
///
2525
/// The error type must always be [`RpcError`](crate::RpcError).
2626
///
@@ -30,7 +30,7 @@ use crate::RpcService;
3030
/// Your [`RpcHandler`] must reply to `Request`s with the correct
3131
/// `Response` or else this crate will panic during routing functions.
3232
///
33-
/// For example, upon a [`JsonRpcRequest::GetBlockCount`] must be replied with
33+
/// For example, a [`JsonRpcRequest::GetBlockCount`] must be replied with
3434
/// [`JsonRpcResponse::GetBlockCount`]. If anything else is returned,
3535
/// this crate may panic.
3636
pub trait RpcHandler:

rpc/interface/src/rpc_request.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

rpc/interface/src/rpc_response.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

rpc/interface/src/rpc_service.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ use crate::rpc_error::RpcError;
1919
///
2020
/// The error type is always [`RpcError`].
2121
///
22+
/// There is a blanket implementation that implements this
23+
/// trait on types that implement `tower::Service` correctly.
24+
///
2225
/// See [`RpcHandler`](crate::RpcHandler) for more information.
2326
pub trait RpcService<Request, Response>:
2427
Clone

0 commit comments

Comments
 (0)