Skip to main content

ServiceBuilder

Trait ServiceBuilder 

Source
pub trait ServiceBuilder<S, Srvc>
where S: Clone + Send + Sync + 'static, AppContext: FromRef<S>, Srvc: Service<S>,
{ // 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§

Source

fn name(&self) -> String

Source

fn enabled(&self, state: &S) -> bool

Source

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".

Implementors§

Source§

impl<S> ServiceBuilder<S, HttpService> for HttpServiceBuilder<S>
where S: Clone + Send + Sync + 'static, AppContext: FromRef<S>,