/// Creates a new instance of RestartStrategy.
///
/// # Arguments
///
/// * `restart_policy` - Defines a restart policy to use for failed actor:
///     - [`RestartStrategy::Always`] would restart the
///         failed actor each time as it fails.
///     - [`RestartStrategy::Never`] would not restart the
///         failed actor and remove it from tracking.
///     - [`RestartStrategy::Tries`] would restart the
///         failed actor a limited amount of times. If can't be started,
///         then will remove it from tracking.   
///
/// * `strategy` - The strategy to use:
///     - [`ActorRestartStrategy::Immediate`] would restart the
///         failed actor as soon as possible.
///     - [`ActorRestartStrategy::LinearBackOff`] would restart the
///         failed actor with the delay increasing linearly.
///     - [`ActorRestartStrategy::ExponentialBackOff`] would restart the
///         failed actor with the delay, multiplied by given coefficient.
///
/// # Example
///
/// ```rust
/// # use std::time::Duration;
/// # use bastion::prelude::*;
/// #
/// # fn main() {
///    let actor_restart_strategy = ActorRestartStrategy::LinearBackOff {
///        timeout: Duration::from_secs(5)
///    };
///    let restart_strategy = RestartStrategy::default()
///       .with_actor_restart_strategy(actor_restart_strategy);
/// # }
/// ```
///
/// [`RestartStrategy::Always`]: enum.RestartPolicy.html#variant.Always
/// [`RestartStrategy::Never`]: enum.RestartPolicy.html#variant.Never
/// [`RestartStrategy::Tries`]: enum.RestartPolicy.html#variant.Tries
/// [`ActorRestartStrategy::Immediate`]: enum.ActorRestartStrategy.html#variant.Immediate
/// [`ActorRestartStrategy::LinearBackOff`]: enum.ActorRestartStrategy.html#variant.LinearBackOff
/// [`ActorRestartStrategy::ExponentialBackOff`]: enum.ActorRestartStrategy.html#variant.ExponentialBackOff
Creates a new instance of RestartStrategy.
Creates a new instance of RestartStrategy .
pub fn new(restart_policy: RestartPolicy, strategy: ActorRestartStrategy) -> Self {
        RestartStrategy {
            restart_policy,
            strategy,
        }
    }
pub fn new ( restart_policy : RestartPolicy , strategy : ActorRestartStrategy ) -> Self { RestartStrategy { restart_policy , strategy , } }
Creates a new instance of RestartStrategy.
Creates a new instance of RestartStrategy .
restart_policy
RestartPolicy
strategy
ActorRestartStrategy
example
None
use std::time::duration;
None
use bastion::prelude::*;
None
fn main() {
let actor_restart_strategy = ActorRestartStrategy::LinearBackOff {
timeout: Duration::from_secs(5)
};
let restart_strategy = RestartStrategy::default()
.with_actor_restart_strategy(actor_restart_strategy).
let actor_restart_strategy = ActorRestartStrategy :: LinearBackOff { timeout : Duration :: from_secs ( 5 ) } ; let restart_strategy = RestartStrategy :: default () . with_actor_restart_strategy ( actor_restart_strategy ) .
}


[`RestartStrategy::Always`]: enum.RestartPolicy.html#variant.Always
[`RestartStrategy::Never`]: enum.RestartPolicy.html#variant.Never
[`RestartStrategy::Tries`]: enum.RestartPolicy.html#variant.Tries
[`ActorRestartStrategy::Immediate`]: enum.ActorRestartStrategy.html#variant.Immediate
[`ActorRestartStrategy::LinearBackOff`]: enum.ActorRestartStrategy.html#variant.LinearBackOff
[`ActorRestartStrategy::ExponentialBackOff`]: enum.ActorRestartStrategy.html#variant.ExponentialBackOff
[ ` RestartStrategy :: Always ` ] : enum . RestartPolicy . html#variant . Always [ ` RestartStrategy :: Never ` ] : enum . RestartPolicy . html#variant . Never [ ` RestartStrategy :: Tries ` ] : enum . RestartPolicy . html#variant . Tries [ ` ActorRestartStrategy :: Immediate ` ] : enum . ActorRestartStrategy . html#variant . Immediate [ ` ActorRestartStrategy :: LinearBackOff ` ] : enum . ActorRestartStrategy . html#variant . LinearBackOff [ ` ActorRestartStrategy :: ExponentialBackOff ` ] : enum . ActorRestartStrategy . html#variant . ExponentialBackOff