pub struct App<S, C> { /* private fields */ }Expand description
Application orchestrator with typestate lifecycle.
Valid transitions are compile-time scoped:
AppBuilder::build() -> App<Built, C>
App<Built, C>::start() -> App<Started, C>
App<Started, C>::stop() -> App<Stopped, C>Implementations§
Source§impl<C: AppConfig> App<Built, C>
impl<C: AppConfig> App<Built, C>
Sourcepub fn builder(config: C) -> AppBuilder<C>
pub fn builder(config: C) -> AppBuilder<C>
Create an AppBuilder.
Source§impl<C> App<Built, C>
impl<C> App<Built, C>
Sourcepub fn lifecycle_event_bus(&self) -> EventBus<LifecycleEvent>
pub fn lifecycle_event_bus(&self) -> EventBus<LifecycleEvent>
Return the bounded lifecycle event bus used by this app.
Sourcepub fn shutdown_token(&self) -> CancellationToken
pub fn shutdown_token(&self) -> CancellationToken
Clone the shutdown token to share with long-running tasks.
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.
Source§impl<C: AppConfig> App<Built, C>
impl<C: AppConfig> App<Built, C>
Source§impl<C> App<Started, C>
impl<C> App<Started, C>
Sourcepub fn lifecycle_event_bus(&self) -> EventBus<LifecycleEvent>
pub fn lifecycle_event_bus(&self) -> EventBus<LifecycleEvent>
Return the bounded lifecycle event bus used by this app.
Sourcepub fn shutdown_token(&self) -> CancellationToken
pub fn shutdown_token(&self) -> CancellationToken
Clone the shutdown token to share with long-running tasks.
Auto Trait Implementations§
impl<S, C> !RefUnwindSafe for App<S, C>
impl<S, C> !UnwindSafe for App<S, C>
impl<S, C> Freeze for App<S, C>
impl<S, C> Send for App<S, C>
impl<S, C> Sync for App<S, C>
impl<S, C> Unpin for App<S, C>where
S: Unpin,
impl<S, C> UnsafeUnpin for App<S, C>
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