pub struct AppBuilder<C: AppConfig> { /* private fields */ }Expand description
Builder for App.
The builder is the composition root for configuration validation, component registration, dependency injection, provider registration, and lifecycle hook ordering.
Implementations§
Source§impl<C: AppConfig> AppBuilder<C>
impl<C: AppConfig> AppBuilder<C>
Sourcepub fn with_graceful_timeout(self, timeout: Duration) -> Self
pub fn with_graceful_timeout(self, timeout: Duration) -> Self
Set the graceful shutdown timeout.
Sourcepub fn with_component(self, component: Arc<dyn Component>) -> Self
pub fn with_component(self, component: Arc<dyn Component>) -> Self
Register a component to be started and stopped by the app lifecycle.
Sourcepub fn with_container(self, container: Arc<Container>) -> Self
pub fn with_container(self, container: Arc<Container>) -> Self
Use an existing typed DI container as the application container.
Sourcepub fn with_lifecycle_event_bus(
self,
lifecycle_events: EventBus<LifecycleEvent>,
) -> Self
pub fn with_lifecycle_event_bus( self, lifecycle_events: EventBus<LifecycleEvent>, ) -> Self
Use an existing bounded lifecycle event bus.
Sourcepub fn with_dependency<T>(self, dependency: Arc<T>) -> Self
pub fn with_dependency<T>(self, dependency: Arc<T>) -> Self
Register a typed dependency in the application DI container.
Sourcepub fn with_provider<P>(self, provider: Arc<P>) -> Self
pub fn with_provider<P>(self, provider: Arc<P>) -> Self
Register a provider implementation in the application DI container.
Sourcepub fn before_start<F, Fut>(self, hook: F) -> Self
pub fn before_start<F, Fut>(self, hook: F) -> Self
Register a hook called before components start.
Sourcepub fn after_start<F, Fut>(self, hook: F) -> Self
pub fn after_start<F, Fut>(self, hook: F) -> Self
Register a hook called after components start and readiness checks pass.
Sourcepub fn before_stop<F, Fut>(self, hook: F) -> Self
pub fn before_stop<F, Fut>(self, hook: F) -> Self
Register a hook called before components stop.
Sourcepub fn after_stop<F, Fut>(self, hook: F) -> Self
pub fn after_stop<F, Fut>(self, hook: F) -> Self
Register a hook called after components stop.
Auto Trait Implementations§
impl<C> !RefUnwindSafe for AppBuilder<C>
impl<C> !UnwindSafe for AppBuilder<C>
impl<C> Freeze for AppBuilder<C>where
C: Freeze,
impl<C> Send for AppBuilder<C>
impl<C> Sync for AppBuilder<C>
impl<C> Unpin for AppBuilder<C>where
C: Unpin,
impl<C> UnsafeUnpin for AppBuilder<C>where
C: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more