chore: make unit type default (#4141)

This commit is contained in:
Matthias Seitz
2023-08-10 14:15:35 +02:00
committed by GitHub
parent 072c84083c
commit 628495ae8f
3 changed files with 7 additions and 13 deletions

View File

@ -344,7 +344,7 @@ where
module_config: TransportRpcModuleConfig,
engine: EngineApi,
) -> (
TransportRpcModules<()>,
TransportRpcModules,
AuthRpcModule,
RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
)
@ -1232,10 +1232,7 @@ impl RpcServerConfig {
}
/// Convenience function to do [RpcServerConfig::build] and [RpcServer::start] in one step
pub async fn start(
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
self.build().await?.start(modules).await
}
@ -1456,7 +1453,7 @@ impl TransportRpcModuleConfig {
/// Holds installed modules per transport type.
#[derive(Debug, Default)]
pub struct TransportRpcModules<Context> {
pub struct TransportRpcModules<Context = ()> {
/// The original config
config: TransportRpcModuleConfig,
/// rpcs module for http
@ -1469,7 +1466,7 @@ pub struct TransportRpcModules<Context> {
// === impl TransportRpcModules ===
impl TransportRpcModules<()> {
impl TransportRpcModules {
/// Returns the [TransportRpcModuleConfig] used to configure this instance.
pub fn module_config(&self) -> &TransportRpcModuleConfig {
&self.config
@ -1694,10 +1691,7 @@ impl RpcServer {
/// This returns an [RpcServerHandle] that's connected to the server task(s) until the server is
/// stopped or the [RpcServerHandle] is dropped.
#[instrument(name = "start", skip_all, fields(http = ?self.http_local_addr(), ws = ?self.ws_local_addr(), ipc = ?self.ipc_endpoint().map(|ipc|ipc.path())), target = "rpc", level = "TRACE")]
pub async fn start(
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
trace!(target: "rpc", "staring RPC server");
let Self { ws_http, ipc: ipc_server } = self;
let TransportRpcModules { config, http, ws, ipc } = modules;