pub struct RestartPolicy {
pub enabled: bool,
pub max_attempts: Option<u32>,
pub delay_ms: u64,
pub backoff_multiplier: f64,
pub max_delay_ms: u64,
}Expand description
Restart policy for server connections.
Controls how the hub handles server disconnections and failures.
Fields§
§enabled: boolWhether to automatically restart on failure
max_attempts: Option<u32>Maximum number of restart attempts (None = unlimited)
delay_ms: u64Delay between restart attempts in milliseconds
backoff_multiplier: f64Exponential backoff multiplier (1.0 = no backoff)
max_delay_ms: u64Maximum delay between restarts in milliseconds
Implementations§
Source§impl RestartPolicy
impl RestartPolicy
Sourcepub fn max_retries(attempts: u32) -> Self
pub fn max_retries(attempts: u32) -> Self
Restart up to N times before giving up.
Sourcepub fn with_delay_ms(self, ms: u64) -> Self
pub fn with_delay_ms(self, ms: u64) -> Self
Set initial delay between restarts (milliseconds).
Sourcepub fn with_backoff(self, multiplier: f64) -> Self
pub fn with_backoff(self, multiplier: f64) -> Self
Set backoff multiplier (e.g., 2.0 doubles delay each attempt).
Sourcepub fn with_max_delay_ms(self, ms: u64) -> Self
pub fn with_max_delay_ms(self, ms: u64) -> Self
Set maximum delay cap (milliseconds).
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> u64
pub fn delay_for_attempt(&self, attempt: u32) -> u64
Calculate delay for a given attempt number (0-indexed).
Trait Implementations§
Source§impl Clone for RestartPolicy
impl Clone for RestartPolicy
Source§fn clone(&self) -> RestartPolicy
fn clone(&self) -> RestartPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RestartPolicy
impl Debug for RestartPolicy
Source§impl Default for RestartPolicy
impl Default for RestartPolicy
Source§impl<'de> Deserialize<'de> for RestartPolicy
impl<'de> Deserialize<'de> for RestartPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RestartPolicy
impl RefUnwindSafe for RestartPolicy
impl Send for RestartPolicy
impl Sync for RestartPolicy
impl Unpin for RestartPolicy
impl UnwindSafe for RestartPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more