#[non_exhaustive]pub enum RestartPolicy {
Always,
OnCrash,
Never,
}Expand description
When the supervisor restarts an exited child. See each variant; in every
case stop_when and
max_restarts can end supervision first.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Always
Restart after every completed run, clean or not.
OnCrash
Restart only after a crash — a run that is not a success
(ProcessResult::is_success): an exit
code outside the accepted set (the command’s
ok_codes, default {0}), a timeout, a signal
kill, or a failure to spawn. A successful run (an accepted exit code) ends
supervision — so a command with ok_codes([0, 2]) exiting 2 is treated
as clean, not a crash.
Never
Never restart: run the child once and report its outcome.
Trait Implementations§
Source§impl Clone for RestartPolicy
impl Clone for RestartPolicy
Source§fn clone(&self) -> RestartPolicy
fn clone(&self) -> RestartPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RestartPolicy
Source§impl Debug for RestartPolicy
impl Debug for RestartPolicy
impl Eq for RestartPolicy
Source§impl PartialEq for RestartPolicy
impl PartialEq for RestartPolicy
Source§fn eq(&self, other: &RestartPolicy) -> bool
fn eq(&self, other: &RestartPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RestartPolicy
Auto Trait Implementations§
impl Freeze for RestartPolicy
impl RefUnwindSafe for RestartPolicy
impl Send for RestartPolicy
impl Sync for RestartPolicy
impl Unpin for RestartPolicy
impl UnsafeUnpin for RestartPolicy
impl UnwindSafe for RestartPolicy
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