pub trait Module: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn version(&self) -> &'static str;
fn configure_routes<'life0, 'async_trait>(
&'life0 self,
router: Router,
) -> Pin<Box<dyn Future<Output = Router> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn configure_services<'life0, 'life1, 'async_trait>(
&'life0 self,
container: &'life1 mut ServiceContainer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModuleResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModuleResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait that all business modules must implement
This trait defines the contract for modules in the Backbone Framework, enabling modular composition and lifecycle management.
Required Methods§
Sourcefn configure_routes<'life0, 'async_trait>(
&'life0 self,
router: Router,
) -> Pin<Box<dyn Future<Output = Router> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn configure_routes<'life0, 'async_trait>(
&'life0 self,
router: Router,
) -> Pin<Box<dyn Future<Output = Router> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn configure_services<'life0, 'life1, 'async_trait>(
&'life0 self,
container: &'life1 mut ServiceContainer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn configure_services<'life0, 'life1, 'async_trait>(
&'life0 self,
container: &'life1 mut ServiceContainer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Configures services in the dependency injection container
§Arguments
container- The service container to register services in
Sourcefn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModuleResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModuleResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes the module
This is called after all services are configured and before the module starts serving requests. Use this for any setup work that needs to be done.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".