Enum fred::types::ReconnectPolicy
[−]
[src]
pub enum ReconnectPolicy {
Constant {
attempts: u32,
max_attempts: u32,
delay: u32,
},
Linear {
attempts: u32,
max_attempts: u32,
max: u32,
delay: u32,
},
Exponential {
attempts: u32,
max_attempts: u32,
min: u32,
max: u32,
mult: u32,
},
}The type of reconnection policy to use. This will apply to every connection used by the client.
attempts should be initialized with 0 but it doesn't really matter, the client will reset it as needed.
min and max refer to the min and max delay to use when reconnecting. These can be used to put bounds
around the amount of time between attempts.
Use a max_attempts value of 0 to retry forever.
Variants
ConstantWait a constant amount of time between reconnect attempts, in ms.
Fields of Constant
attempts: u32 | |
max_attempts: u32 | |
delay: u32 |
LinearBackoff reconnection attempts linearly, adding delay each time.
Fields of Linear
attempts: u32 | |
max_attempts: u32 | |
max: u32 | |
delay: u32 |
ExponentialBackoff reconnection attempts exponentially, multiplying the last delay by mult each time.
Fields of Exponential
attempts: u32 | |
max_attempts: u32 | |
min: u32 | |
max: u32 | |
mult: u32 |
Methods
impl ReconnectPolicy[src]
fn reset_attempts(&mut self)
Reset the number of reconnection attempts. It's unlikely users will need to call this.
fn attempts(&self) -> u32
Read the number of reconnection attempts.
fn next_delay(&mut self) -> Option<u32>
Calculate the next delay, incrementing attempts in the process. It's unlikely users will need to call this.
Trait Implementations
impl Clone for ReconnectPolicy[src]
fn clone(&self) -> ReconnectPolicy
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Debug for ReconnectPolicy[src]
impl Eq for ReconnectPolicy[src]
impl PartialEq for ReconnectPolicy[src]
fn eq(&self, __arg_0: &ReconnectPolicy) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &ReconnectPolicy) -> bool
This method tests for !=.