[][src]Struct bastion::supervisor::RestartStrategy

pub struct RestartStrategy { /* fields omitted */ }

The strategy for a supervisor which is used for restoring failed actors. It it fails after N attempts, the supervisor will remove an actor.

The default strategy used is ActorRestartStrategy::Immediate with the RestartPolicy::Always restart policy.


impl RestartStrategy[src]

pub fn new(
    restart_policy: RestartPolicy,
    strategy: ActorRestartStrategy
) -> Self

Creates a new instance of RestartStrategy.



let actor_restart_strategy = ActorRestartStrategy::LinearBackOff {
    timeout: Duration::from_secs(5)
let restart_strategy = RestartStrategy::default()

pub fn restart_policy(&self) -> RestartPolicy[src]

Returns the acceptable count of retries for the failed actor. The None value means the amount of attempts is unlimited.

pub fn strategy(&self) -> ActorRestartStrategy[src]

Returns the current strategy for restarting failed actors.

pub fn with_restart_policy(self, restart_policy: RestartPolicy) -> Self[src]

Sets the limit of attempts for restoring failed actors.

pub fn with_actor_restart_strategy(self, strategy: ActorRestartStrategy) -> Self[src]

Sets the actor restart strategy the supervisor should use of its supervised children groups or supervisors dies to restore in the correct state.

Trait Implementations

impl Clone for RestartStrategy[src]

impl Debug for RestartStrategy[src]

impl Default for RestartStrategy[src]

impl PartialEq<RestartStrategy> for RestartStrategy[src]

impl StructuralPartialEq for RestartStrategy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> AsAny for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Message for T where
    T: Any + Send + Sync + Debug

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> State for T where
    T: Send + Sync + 'static, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,