Skip to content

Commit

Permalink
feat(rpc): setters for TransportRpcModules
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk committed Jan 11, 2025
1 parent 5a23708 commit 587a1bf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,30 @@ pub struct TransportRpcModules<Context = ()> {
// === impl TransportRpcModules ===

impl TransportRpcModules {
/// Sets a custom [`TransportRpcModuleConfig`] for the configured modules.
pub fn with_config(mut self, config: TransportRpcModuleConfig) -> Self {
self.config = config;
self
}

/// Sets the [`RpcModule`] for the http transport.
pub fn with_http(mut self, http: RpcModule<()>) -> Self {
self.http = Some(http);
self
}

/// Sets the [`RpcModule`] for the ws transport.
pub fn with_ws(mut self, ws: RpcModule<()>) -> Self {
self.ws = Some(ws);
self
}

/// Sets the [`RpcModule`] for the http transport.
pub fn with_ipc(mut self, ipc: RpcModule<()>) -> Self {
self.ipc = Some(ipc);
self
}

/// Returns the [`TransportRpcModuleConfig`] used to configure this instance.
pub const fn module_config(&self) -> &TransportRpcModuleConfig {
&self.config
Expand Down

0 comments on commit 587a1bf

Please sign in to comment.