pub struct AdaptiveInterval {
pub base: Duration,
pub min: Duration,
pub max: Duration,
/* private fields */
}Expand description
Adaptive interval that adjusts based on connection stability.
This is used by the health monitor to check connections more frequently when connections are unstable, and less frequently when stable.
Fields§
§base: DurationBase interval when connections are stable.
min: DurationMinimum interval (most frequent checking).
max: DurationMaximum interval (least frequent checking).
Implementations§
Source§impl AdaptiveInterval
impl AdaptiveInterval
Sourcepub fn new(base: Duration, min: Duration, max: Duration) -> Self
pub fn new(base: Duration, min: Duration, max: Duration) -> Self
Create a new adaptive interval with custom settings.
Sourcepub fn on_success(&mut self)
pub fn on_success(&mut self)
Record a successful health check.
After enough consecutive successes, the interval will increase (less frequent checks) up to the maximum.
Sourcepub fn on_failure(&mut self)
pub fn on_failure(&mut self)
Record a failed health check (connection lost or reconnect needed).
After enough consecutive failures, the interval will decrease (more frequent checks) down to the minimum.
Trait Implementations§
Source§impl Clone for AdaptiveInterval
impl Clone for AdaptiveInterval
Source§fn clone(&self) -> AdaptiveInterval
fn clone(&self) -> AdaptiveInterval
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 AdaptiveInterval
impl Debug for AdaptiveInterval
Auto Trait Implementations§
impl Freeze for AdaptiveInterval
impl RefUnwindSafe for AdaptiveInterval
impl Send for AdaptiveInterval
impl Sync for AdaptiveInterval
impl Unpin for AdaptiveInterval
impl UnwindSafe for AdaptiveInterval
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