pub struct Lifecycle { /* private fields */ }Expand description
Tracks work started by a generated mediator.
Generated code registers every event worker and #[medi_task] before it is
spawned, and marks it complete when its future returns. Self::wait is
therefore the completion guarantee used by mediator shutdown.
Implementations§
Source§impl Lifecycle
impl Lifecycle
Sourcepub fn start(&self) -> Result<(), StartError>
pub fn start(&self) -> Result<(), StartError>
Mark the mediator as started.
Returns StartError::AlreadyStarted if another caller has already
started it. This operation is atomic across concurrent callers.
Sourcepub fn is_started(&self) -> bool
pub fn is_started(&self) -> bool
Return whether the mediator has been started.
Sourcepub fn request_shutdown(&self) -> bool
pub fn request_shutdown(&self) -> bool
Request shutdown, returning true only for the caller that initiated it.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Lifecycle
impl !RefUnwindSafe for Lifecycle
impl Send for Lifecycle
impl Sync for Lifecycle
impl Unpin for Lifecycle
impl UnsafeUnpin for Lifecycle
impl UnwindSafe for Lifecycle
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