pub struct AppBuilder<C>where
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> AppBuilder<C>where
C: AppConfig,
impl<C> AppBuilder<C>where
C: AppConfig,
Sourcepub fn new(config: C) -> AppBuilder<C>
pub fn new(config: C) -> AppBuilder<C>
Create a new builder with the given application configuration.
Sourcepub fn with_graceful_timeout(self, timeout: Duration) -> AppBuilder<C>
pub fn with_graceful_timeout(self, timeout: Duration) -> AppBuilder<C>
Set the graceful shutdown timeout.
Sourcepub fn with_component(self, component: Arc<dyn Component>) -> AppBuilder<C>
pub fn with_component(self, component: Arc<dyn Component>) -> AppBuilder<C>
Register a component to be started and stopped by the app lifecycle.
Sourcepub fn with_container(self, container: Arc<Container>) -> AppBuilder<C>
pub fn with_container(self, container: Arc<Container>) -> AppBuilder<C>
Use an existing typed DI container as the application container.
Sourcepub fn with_lifecycle_event_bus(
self,
lifecycle_events: EventBus<LifecycleEvent>,
) -> AppBuilder<C>
pub fn with_lifecycle_event_bus( self, lifecycle_events: EventBus<LifecycleEvent>, ) -> AppBuilder<C>
Use an existing bounded lifecycle event bus.
Sourcepub fn with_dependency<T>(self, dependency: Arc<T>) -> AppBuilder<C>
pub fn with_dependency<T>(self, dependency: Arc<T>) -> AppBuilder<C>
Register a typed dependency in the application DI container.
Sourcepub fn with_provider<P>(self, provider: Arc<P>) -> AppBuilder<C>
pub fn with_provider<P>(self, provider: Arc<P>) -> AppBuilder<C>
Register a provider implementation in the application DI container.
Sourcepub fn before_start<F, Fut>(self, hook: F) -> AppBuilder<C>
pub fn before_start<F, Fut>(self, hook: F) -> AppBuilder<C>
Register a hook called before components start.
Sourcepub fn after_start<F, Fut>(self, hook: F) -> AppBuilder<C>
pub fn after_start<F, Fut>(self, hook: F) -> AppBuilder<C>
Register a hook called after components start and readiness checks pass.
Sourcepub fn before_stop<F, Fut>(self, hook: F) -> AppBuilder<C>
pub fn before_stop<F, Fut>(self, hook: F) -> AppBuilder<C>
Register a hook called before components stop.
Sourcepub fn after_stop<F, Fut>(self, hook: F) -> AppBuilder<C>
pub fn after_stop<F, Fut>(self, hook: F) -> AppBuilder<C>
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request