pub trait NodeBuilder<N: Node>: Sized {
type Error: Error;
type Config;
// Required methods
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§
Sourcefn new(config: Self::Config) -> Result<Self, Self::Error>
fn new(config: Self::Config) -> Result<Self, Self::Error>
Begin building a new node with the provided configuration state.
Sourcefn with_worker<W: Worker<N> + 'static>(self) -> Self
fn with_worker<W: Worker<N> + 'static>(self) -> Self
Register a worker, with default configuration state, that should be started with the node.
Sourcefn 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.
Sourcefn 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".