#[non_exhaustive]pub enum RestartPolicy {
Never,
Always,
OnFailure {
maximum_retries: Option<NonZeroU64>,
},
UnlessStopped,
}Expand description
Container-level automatic restart intent.
This policy is distinct from Compose dependency restart propagation and orchestrator-level deployment restart policies. A limited on-failure policy uses a non-zero retry count so the absence of a limit remains distinguishable from an invalid zero-valued limit.
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.
Never
Never restart the container automatically.
Always
Restart after every container exit.
OnFailure
Restart after a failed container exit, optionally up to a finite retry count.
Fields
§
maximum_retries: Option<NonZeroU64>Maximum number of restart attempts; None means no policy-specific limit.
UnlessStopped
Restart automatically unless an explicit stop state must survive runtime restart.
Implementations§
Source§impl RestartPolicy
impl RestartPolicy
Sourcepub const fn on_failure(maximum_retries: Option<NonZeroU64>) -> Self
pub const fn on_failure(maximum_retries: Option<NonZeroU64>) -> Self
Creates an on-failure policy with an optional non-zero retry limit.
Sourcepub const fn maximum_retries(self) -> Option<NonZeroU64>
pub const fn maximum_retries(self) -> Option<NonZeroU64>
Returns the finite retry limit of an on-failure policy.
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
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