mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add helper function to modify node builder (#11682)
This commit is contained in:
@ -162,6 +162,14 @@ impl<ChainSpec> NodeBuilder<(), ChainSpec> {
|
||||
pub const fn new(config: NodeConfig<ChainSpec>) -> Self {
|
||||
Self { config, database: () }
|
||||
}
|
||||
|
||||
/// Apply a function to the builder
|
||||
pub fn apply<F>(self, f: F) -> Self
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
f(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB, ChainSpec> NodeBuilder<DB, ChainSpec> {
|
||||
@ -400,6 +408,14 @@ where
|
||||
&self.builder.config
|
||||
}
|
||||
|
||||
/// Apply a function to the builder
|
||||
pub fn apply<F>(self, f: F) -> Self
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
f(self)
|
||||
}
|
||||
|
||||
/// Sets the hook that is run once the node's components are initialized.
|
||||
pub fn on_component_initialized<F>(self, hook: F) -> Self
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user