pub trait ServiceProvider: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn register(
&self,
builder: ContainerBuilder,
) -> Result<ContainerBuilder, ProviderError>;
// Provided methods
fn boot(&self, container: &Container) -> Result<(), ProviderError> { ... }
fn dependencies(&self) -> Vec<&'static str> { ... }
fn defer_boot(&self) -> bool { ... }
}Expand description
Service provider trait for registering services and managing lifecycle
Required Methods§
Sourcefn register(
&self,
builder: ContainerBuilder,
) -> Result<ContainerBuilder, ProviderError>
fn register( &self, builder: ContainerBuilder, ) -> Result<ContainerBuilder, ProviderError>
Register services in the container builder This is called during the registration phase
Provided Methods§
Sourcefn boot(&self, container: &Container) -> Result<(), ProviderError>
fn boot(&self, container: &Container) -> Result<(), ProviderError>
Boot the provider after all services are registered This is called during the boot phase with access to the built container
Sourcefn dependencies(&self) -> Vec<&'static str>
fn dependencies(&self) -> Vec<&'static str>
Provider dependencies (other providers that must be registered first)
Sourcefn defer_boot(&self) -> bool
fn defer_boot(&self) -> bool
Defer boot phase (useful for providers that need other providers to be booted first)