reth_node_builder/components/
network.rsuse std::future::Future;
use reth_network::NetworkHandle;
use reth_transaction_pool::TransactionPool;
use crate::{BuilderContext, FullNodeTypes};
pub trait NetworkBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Send {
fn build_network(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<Output = eyre::Result<NetworkHandle>> + Send;
}
impl<Node, F, Fut, Pool> NetworkBuilder<Node, Pool> for F
where
Node: FullNodeTypes,
Pool: TransactionPool,
F: Fn(&BuilderContext<Node>, Pool) -> Fut + Send,
Fut: Future<Output = eyre::Result<NetworkHandle>> + Send,
{
fn build_network(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<Output = eyre::Result<NetworkHandle>> + Send {
self(ctx, pool)
}
}