pub enum RestartStrategy {
OneForOne,
OneForAll,
RestForOne,
}Expand description
Strategy that determines which children are restarted when one fails.
These strategies are modeled after Erlang/OTP supervisor behaviors
and are used by SupervisorRuntime::restart_scope to compute
the range of children to restart.
§Variants
Given children [A, B, C, D, E] where C (index 2) fails:
| Strategy | Restarted children |
|---|---|
OneForOne | [C] |
OneForAll | [A, B, C, D, E] |
RestForOne | [C, D, E] |
Variants§
OneForOne
Restart only the failed child. Other children are unaffected.
This is the default strategy and is appropriate when children are independent of each other.
OneForAll
Restart all children when any single child fails.
Use this when children have interdependencies and a consistent group state is required.
RestForOne
Restart the failed child and all children started after it.
This is useful when later children depend on earlier ones: restarting from the failure point forward re-establishes the dependency chain without disturbing earlier, independent children.
Trait Implementations§
Source§impl Clone for RestartStrategy
impl Clone for RestartStrategy
Source§fn clone(&self) -> RestartStrategy
fn clone(&self) -> RestartStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more