pub struct ReconnectPolicy {
pub enabled: bool,
pub max_retries: u32,
pub initial_delay_ms: u64,
pub max_delay_ms: u64,
pub backoff_factor: f64,
}Expand description
重连策略 / Reconnect policy
Fields§
§enabled: bool是否启用自动重连 / Whether to enable auto reconnect
max_retries: u32最大重试次数(0表示无限重试)/ Max retry count (0 means infinite)
initial_delay_ms: u64初始延迟时间(毫秒)/ Initial delay in milliseconds
max_delay_ms: u64最大延迟时间(毫秒)/ Max delay in milliseconds
backoff_factor: f64退避因子(延迟时间乘数)/ Backoff factor (delay multiplier)
Implementations§
Source§impl ReconnectPolicy
impl ReconnectPolicy
Sourcepub fn calculate_delay(&self, retry_count: u32) -> Duration
pub fn calculate_delay(&self, retry_count: u32) -> Duration
计算下次重试的延迟时间 / Calculate delay for next retry
Sourcepub fn should_retry(&self, retry_count: u32) -> bool
pub fn should_retry(&self, retry_count: u32) -> bool
检查是否应该继续重试 / Check if should continue retry
Trait Implementations§
Source§impl Clone for ReconnectPolicy
impl Clone for ReconnectPolicy
Source§fn clone(&self) -> ReconnectPolicy
fn clone(&self) -> ReconnectPolicy
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 ReconnectPolicy
impl Debug for ReconnectPolicy
Source§impl Default for ReconnectPolicy
impl Default for ReconnectPolicy
Source§impl<'de> Deserialize<'de> for ReconnectPolicy
impl<'de> Deserialize<'de> for ReconnectPolicy
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
Source§impl PartialEq for ReconnectPolicy
impl PartialEq for ReconnectPolicy
Source§impl Serialize for ReconnectPolicy
impl Serialize for ReconnectPolicy
impl StructuralPartialEq for ReconnectPolicy
Auto Trait Implementations§
impl Freeze for ReconnectPolicy
impl RefUnwindSafe for ReconnectPolicy
impl Send for ReconnectPolicy
impl Sync for ReconnectPolicy
impl Unpin for ReconnectPolicy
impl UnsafeUnpin for ReconnectPolicy
impl UnwindSafe for ReconnectPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.