pub trait ServiceBuilder<S, Srvc>{
// Required methods
fn name(&self) -> String;
fn enabled(&self, state: &S) -> bool;
fn build<'life0, 'async_trait>(
self,
state: &'life0 S,
) -> Pin<Box<dyn Future<Output = RoadsterResult<Srvc>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait used to build a Service. It’s not a requirement that services implement this
trait; it is provided as a convenience. A builder can be provided to
the ServiceRegistry instead of a Service,
in which case the ServiceRegistry will only
build and register the service if Service::enabled is true.
Required Methods§
fn name(&self) -> String
fn enabled(&self, state: &S) -> bool
fn build<'life0, 'async_trait>(
self,
state: &'life0 S,
) -> Pin<Box<dyn Future<Output = RoadsterResult<Srvc>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".