pub struct SupervisorHandle { /* private fields */ }Expand description
Control of a running supervisor. Dropping it stops the supervisor and its child.
Implementations§
Source§impl SupervisorHandle
impl SupervisorHandle
Sourcepub fn status(&self) -> SupervisorStatus
pub fn status(&self) -> SupervisorStatus
The state now.
Sourcepub fn restart_now(&self)
pub fn restart_now(&self)
Ask for a start: a running child is stopped and counted as an exit (then the policy decides, so a policy that waits for demand starts at once); a child waiting for demand starts; an exhausted or stopped policy forgets its budget and starts. A pending backoff is left to run. Returns before the work is done.
Sourcepub fn restart_now_with_lock(&self, state: LockState)
pub fn restart_now_with_lock(&self, state: LockState)
restart_now with the lock state the next launch starts from,
overriding the LockStateFn for that one launch. LockState::Unknown (an unlock
that was never answered) starts the replacement locked.
Sourcepub fn stop(self)
pub fn stop(self)
Stop the child (stdin closed, then killed after the grace) and end the supervisor. Waits for the thread to finish.
Sourcepub fn stop_returning_child(self) -> Option<PrivateChild>
pub fn stop_returning_child(self) -> Option<PrivateChild>
End the supervisor without stopping the child, handing the running child back once
(None when no child is running) so the caller can shut it down in its own order.
No restart follows: the supervisor thread has ended when this returns. Consumes the
handle, so the child can be taken only once.