pub struct LifecycleManager { /* private fields */ }Expand description
Coordinates ordered lifecycle hooks for one application.
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
Sourcepub fn add_hook<H>(&mut self, hook: H) -> &mut Selfwhere
H: LifecycleHook + 'static,
pub fn add_hook<H>(&mut self, hook: H) -> &mut Selfwhere
H: LifecycleHook + 'static,
Adds a lifecycle hook that starts after previously registered hooks.
Sourcepub const fn state(&self) -> LifecycleState
pub const fn state(&self) -> LifecycleState
Returns the manager’s current lifecycle state.
Sourcepub async fn start(&mut self, context: &ApplicationContext) -> Result<()>
pub async fn start(&mut self, context: &ApplicationContext) -> Result<()>
Starts infrastructure hooks by owner before application hooks in registration order.
Sourcepub async fn shutdown(&mut self, context: &ApplicationContext) -> Result<()>
pub async fn shutdown(&mut self, context: &ApplicationContext) -> Result<()>
Stops all hooks in reverse successful startup order.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LifecycleManager
impl !UnwindSafe for LifecycleManager
impl Forget for LifecycleManager
impl Freeze for LifecycleManager
impl Move for LifecycleManager
impl Send for LifecycleManager
impl Sync for LifecycleManager
impl Unpin for LifecycleManager
impl UnsafeUnpin for LifecycleManager
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