/// Sets the strategy the supervisor should use when one
/// of its supervised children groups or supervisors dies
/// (in the case of a children group, it could be because one
/// of its elements panicked or returned an error).
///
/// The default strategy is
/// [`SupervisionStrategy::OneForOne`].
///
/// # Arguments
///
/// * `strategy` - The strategy to use:
///     - [`SupervisionStrategy::OneForOne`] would only restart
///         the supervised children groups or supervisors that
///         fault.
///     - [`SupervisionStrategy::OneForAll`] would restart all
///         the supervised children groups or supervisors (even
///         those which were stopped) when one of them faults,
///         respecting the order in which they were added.
///     - [`SupervisionStrategy::RestForOne`] would restart the
///         supervised children groups or supervisors that fault
///         along with all the other supervised children groups
///         or supervisors that were added after them (even the
///         stopped ones), respecting the order in which they
///         were added.
///
/// # Example
///
/// ```rust
/// # use bastion::prelude::*;
/// #
/// # fn main() {
///     # Bastion::init();
///     #
/// Bastion::supervisor(|sp| {
///     // Note that "one-for-one" is the default strategy.
///     sp.with_strategy(SupervisionStrategy::OneForOne)
/// }).expect("Couldn't create the supervisor");
///     #
///     # Bastion::start();
///     # Bastion::stop();
///     # Bastion::block_until_stopped();
/// # }
/// ```
///
/// [`SupervisionStrategy::OneForOne`]: supervisor/enum.SupervisionStrategy.html#variant.OneForOne
/// [`SupervisionStrategy::OneForAll`]: supervisor/enum.SupervisionStrategy.html#variant.OneForAll
/// [`SupervisionStrategy::RestForOne`]: supervisor/enum.SupervisionStrategy.html#variant.RestForOne
Sets the strategy the supervisor should use when one
of its supervised children groups or supervisors dies
(in the case of a children group, it could be because one
of its elements panicked or returned an error).


Sets the strategy the supervisor should use when one of its supervised children groups or supervisors dies ( in the case of a children group it could be because one of its elements panicked or returned an error ) .
pub fn with_strategy(mut self, strategy: SupervisionStrategy) -> Self {
        trace!(
            "Supervisor({}): Setting strategy: {:?}",
            self.id(),
            strategy
        );
        self.strategy = strategy;
        self
    }
pub fn with_strategy ( mut self , strategy : SupervisionStrategy ) -> Self { trace ! ( " " self id ( ) strategy ) ; self . strategy = strategy ; self }
Sets the strategy the supervisor should use when one
of its supervised children groups or supervisors dies
(in the case of a children group, it could be because one
of its elements panicked or returned an error).
Sets the strategy the supervisor should use when one of its supervised children groups or supervisors dies ( in the case of a children group it could be because one of its elements panicked or returned an error ) .
mut self
strategy
SupervisionStrategy
example
None
use bastion::prelude::*;
None
fn main() {


:supervisor(|sp| {
Note that "one-for-one" is the default strategy.
sp.with_strategy(SupervisionStrategy::OneForOne)
}).expect("Couldn't create the supervisor").

:start();
Bastion::stop();
Bastion::block_until_stopped().
: supervisor ( |sp| { Note that " one - for - one " is the default strategy . sp . with_strategy ( SupervisionStrategy :: OneForOne ) } ) . expect ( " Couldn ' t create the supervisor " ) . : start () ; Bastion :: stop () ; Bastion :: block_until_stopped () .
}


[`SupervisionStrategy::OneForOne`]: supervisor/enum.SupervisionStrategy.html#variant.OneForOne
[`SupervisionStrategy::OneForAll`]: supervisor/enum.SupervisionStrategy.html#variant.OneForAll
[`SupervisionStrategy::RestForOne`]: supervisor/enum.SupervisionStrategy.html#variant.RestForOne
[ ` SupervisionStrategy :: OneForOne ` ] : supervisor / enum . SupervisionStrategy . html#variant . OneForOne [ ` SupervisionStrategy :: OneForAll ` ] : supervisor / enum . SupervisionStrategy . html#variant . OneForAll [ ` SupervisionStrategy :: RestForOne ` ] : supervisor / enum . SupervisionStrategy . html#variant . RestForOne