pub enum ReconnectStrategy {
    Fail,
    ExponentialBackoff {
        base: Duration,
        factor: f64,
        max_duration: Option<Duration>,
        max_retries: Option<usize>,
        timeout: Option<Duration>,
    },
    FibonacciBackoff {
        base: Duration,
        max_duration: Option<Duration>,
        max_retries: Option<usize>,
        timeout: Option<Duration>,
    },
    FixedInterval {
        interval: Duration,
        max_retries: Option<usize>,
        timeout: Option<Duration>,
    },
}
Expand description

Represents the strategy to apply when attempting to reconnect the client to the server.

Variants

Fail

A retry strategy that will fail immediately if a reconnect is attempted.

ExponentialBackoff

Fields

base: Duration

Represents the initial time to wait between reconnect attempts.

factor: f64

Factor to use when modifying the retry time, used as a multiplier.

max_duration: Option<Duration>

Represents the maximum duration to wait between attempts. None indicates no limit.

max_retries: Option<usize>

Represents the maximum attempts to retry before failing. None indicates no limit.

timeout: Option<Duration>

Represents the maximum time to wait for a reconnect attempt. None indicates no limit.

A retry strategy driven by exponential back-off.

FibonacciBackoff

Fields

base: Duration

Represents the initial time to wait between reconnect attempts.

max_duration: Option<Duration>

Represents the maximum duration to wait between attempts. None indicates no limit.

max_retries: Option<usize>

Represents the maximum attempts to retry before failing. None indicates no limit.

timeout: Option<Duration>

Represents the maximum time to wait for a reconnect attempt. None indicates no limit.

A retry strategy driven by the fibonacci series.

FixedInterval

Fields

interval: Duration

Represents the time between reconnect attempts.

max_retries: Option<usize>

Represents the maximum attempts to retry before failing. None indicates no limit.

timeout: Option<Duration>

Represents the maximum time to wait for a reconnect attempt. None indicates no limit.

A retry strategy driven by a fixed interval.

Implementations

Returns true if this strategy is the fail variant.

Returns true if this strategy is the exponential backoff variant.

Returns true if this strategy is the fibonacci backoff variant.

Returns true if this strategy is the fixed interval variant.

Returns the maximum duration between reconnect attempts, or None if there is no limit.

Returns the maximum reconnect attempts the strategy will perform, or None if will attempt forever.

Returns the timeout per reconnect attempt that is associated with the strategy.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Creates a reconnect strategy that will immediately fail.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.