pub trait ApplicationPartBuilder {
type ApplicationPart: ApplicationPart + Send + Sync;
// Required method
fn build(
self,
service_provider: ServiceProvider,
) -> ConstructionResult<Self::ApplicationPart>;
}Expand description
Builder trait for constructing application parts.
Implementors of this trait are responsible for producing an application part instance from a service provider. This is typically used in the application builder to allow flexible composition of application parts.
See ApplicationPart for lifecycle hooks and error handling.
Required Associated Types§
Sourcetype ApplicationPart: ApplicationPart + Send + Sync
type ApplicationPart: ApplicationPart + Send + Sync
The type of application part produced by this builder.
This must implement ApplicationPart.
Required Methods§
Sourcefn build(
self,
service_provider: ServiceProvider,
) -> ConstructionResult<Self::ApplicationPart>
fn build( self, service_provider: ServiceProvider, ) -> ConstructionResult<Self::ApplicationPart>
Builds an application part instance using the provided service provider.
§Arguments
service_provider- The application’s service provider, used to resolve dependencies for the application part.
§Returns
A ConstructionResult containing the constructed Self::ApplicationPart on success, or an error if construction fails.
§Errors
Returns an error if the application part or any of its dependencies cannot be constructed from the service provider.