pub fn strategy(&self, strategy: SupervisionStrategy) -> Result<(), ()> {
        debug!(
            "SupervisorRef({}): Setting strategy: {:?}",
            self.id(),
            strategy
        );
        let msg = BastionMessage::supervise_with(strategy);
        let env = Envelope::from_dead_letters(msg);
        self.send(env).map_err(|_| ())
    }
/// Sends to the supervisor this `SupervisorRef` is
/// referencing the strategy that it should start
/// using 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 `Supervisor` is
/// [`SupervisionStrategy::OneForOne`].
///
/// This method returns `()` if it succeeded, or `Err(())`
/// otherwise.
///
/// # 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
///
/// ```
/// # use bastion::prelude::*;
/// #
/// # fn main() {
///     # Bastion::init();
///     #
///     # let sp_ref = Bastion::supervisor(|sp| sp).unwrap();
/// // Note that "one-for-one" is the default strategy.
/// sp_ref.strategy(SupervisionStrategy::OneForOne);
///     #
///     # 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
Sends to the supervisor this `SupervisorRef` is
referencing the strategy that it should start
using 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).



This method returns `()` if it succeeded, or `Err(())`
otherwise.
Sends to the supervisor this ` SupervisorRef ` is referencing the strategy that it should start using 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 ) . This method returns ` () ` if it succeeded or ` Err (( )) ` otherwise .
pub fn strategy(&self, strategy: SupervisionStrategy) -> Result<(), ()> {
        debug!(
            "SupervisorRef({}): Setting strategy: {:?}",
            self.id(),
            strategy
        );
        let msg = BastionMessage::supervise_with(strategy);
        let env = Envelope::from_dead_letters(msg);
        self.send(env).map_err(|_| ())
    }
pub fn strategy ( & self , strategy : SupervisionStrategy ) -> Result < ( ) , ( ) > { debug ! ( " " self id ( ) strategy ) ; let msg = BastionMessage :: supervise_with ( strategy ) ; let env = Envelope :: from_dead_letters ( msg ) ; self . send ( env ) . map_err ( | _ | ( ) ) }
Sends to the supervisor this `SupervisorRef` is
referencing the strategy that it should start
using 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).
Sends to the supervisor this ` SupervisorRef ` is referencing the strategy that it should start using 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 ) .
&self
strategy
SupervisionStrategy
&self
strategy
SupervisionStrategy
example
None
use bastion::prelude::*;
None
fn main() {


let sp_ref = Bastion::supervisor(|sp| sp).unwrap();
Note that "one-for-one" is the default strategy.
sp_ref.strategy(SupervisionStrategy::OneForOne).

:start();
Bastion::stop();
Bastion::block_until_stopped().
let sp_ref = Bastion :: supervisor ( |sp| sp ) . unwrap () ; Note that " one - for - one " is the default strategy . sp_ref . strategy ( SupervisionStrategy :: OneForOne ) . : 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