Trait bee_runtime::node::NodeBuilder
source · [−]pub trait NodeBuilder<N: Node>: Sized {
type Error: Error;
type Config;
fn new(config: Self::Config) -> Result<Self, Self::Error>;
fn with_worker<W: Worker<N> + 'static>(self) -> Self
where
W::Config: Default;
fn with_worker_cfg<W: Worker<N> + 'static>(self, config: W::Config) -> Self;
fn with_resource<R: Any + Send + Sync>(self, res: R) -> Self;
fn finish<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<N, Self::Error>> + 'async_trait>>
where
Self: 'async_trait;
}
Expand description
A trait that provides generic build configuration capabilities for a node.
Required Associated Types
Required Methods
Begin building a new node with the provided configuration state.
fn with_worker<W: Worker<N> + 'static>(self) -> Self where
W::Config: Default,
fn with_worker<W: Worker<N> + 'static>(self) -> Self where
W::Config: Default,
Register a worker, with default configuration state, that should be started with the node.
fn with_worker_cfg<W: Worker<N> + 'static>(self, config: W::Config) -> Self
fn with_worker_cfg<W: Worker<N> + 'static>(self, config: W::Config) -> Self
Register a worker, with the given configuration state, that should be started with the node.
fn with_resource<R: Any + Send + Sync>(self, res: R) -> Self
fn with_resource<R: Any + Send + Sync>(self, res: R) -> Self
Provide a resource that should be registered with the node upon start.