pub struct LifecycleHandle { /* private fields */ }Expand description
RAII handle that runs a LifecycleDaemon’s lifecycle.
Construction calls on_start; drop schedules on_stop on a
detached task so the synchronous Drop impl can fire-and-forget
the async shutdown.
For deterministic shutdown ordering (net aggregator shutdown
waiting on the loop to fully drain before returning), use
LifecycleHandle::stop instead of dropping.
Implementations§
Source§impl LifecycleHandle
impl LifecycleHandle
Sourcepub async fn start(
daemon: Arc<dyn LifecycleDaemon>,
) -> Result<Self, LifecycleError>
pub async fn start( daemon: Arc<dyn LifecycleDaemon>, ) -> Result<Self, LifecycleError>
Construct a handle and run on_start synchronously
against the async runtime. Errors abort — the handle is
never created if start fails.
Sourcepub fn daemon(&self) -> &Arc<dyn LifecycleDaemon> ⓘ
pub fn daemon(&self) -> &Arc<dyn LifecycleDaemon> ⓘ
Borrow the underlying daemon for introspection. Operator tooling that wants type-erased access reads through this — the lifecycle handle alone doesn’t expose concrete daemon state.
Trait Implementations§
Source§impl Drop for LifecycleHandle
impl Drop for LifecycleHandle
Auto Trait Implementations§
impl Freeze for LifecycleHandle
impl !RefUnwindSafe for LifecycleHandle
impl Send for LifecycleHandle
impl Sync for LifecycleHandle
impl Unpin for LifecycleHandle
impl UnsafeUnpin for LifecycleHandle
impl !UnwindSafe for LifecycleHandle
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