pub struct SoftCycleController { /* private fields */ }Expand description
Controller for soft restarts and graceful shutdowns.
See the crate-level documentation for usage, notices, and a full example.
Implementations§
Source§impl SoftCycleController
impl SoftCycleController
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SoftCycleController.
Sourcepub async fn try_restart(&self) -> bool
pub async fn try_restart(&self) -> bool
Attempts to trigger a restart.
Returns true if successful, and false if a shutdown or restart has already been triggered.
Sourcepub async fn try_shutdown(&self) -> bool
pub async fn try_shutdown(&self) -> bool
Attempts to trigger a shutdown.
Returns true if successful, and false if a shutdown or restart has already been triggered.
Sourcepub async fn try_trigger(&self, is_shutdown: bool) -> bool
pub async fn try_trigger(&self, is_shutdown: bool) -> bool
Attempts to trigger a shutdown or restart.
Returns true if successful, and false if a shutdown or restart has already been triggered.
Sourcepub fn listener<'a>(&'a self) -> SoftCycleListener<'a> ⓘ
pub fn listener<'a>(&'a self) -> SoftCycleListener<'a> ⓘ
Listener that resolves when a restart or shutdown is triggered. Returns true if a shutdown was triggered, and false if a restart was triggered.
If the controller is already in a triggered state, this will resolve after the next trigger.