pub struct Backoff {
pub wait_minimum: Duration,
pub random_range: Duration,
pub repeat_times: u32,
}Expand description
The three OCPPCommCtrlr variables that drive reconnect timing (Part 4 §5.4).
Fields§
§wait_minimum: DurationRetryBackOffWaitMinimum — the wait before the first retry.
random_range: DurationRetryBackOffRandomRange — the width of the uniform jitter added to every wait.
repeat_times: u32RetryBackOffRepeatTimes — how many times the wait is doubled before it stops
growing.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn delay(&self, attempt: u32, jitter: f64) -> Duration
pub fn delay(&self, attempt: u32, jitter: f64) -> Duration
The wait before retry number attempt (0 is the first retry).
jitter must be a uniformly distributed value in 0.0 ..= 1.0; the caller supplies
it so that the schedule stays deterministic under test and the engine needs no
entropy source of its own.
Trait Implementations§
impl Copy for Backoff
impl Eq for Backoff
impl StructuralPartialEq for Backoff
Auto Trait Implementations§
impl Freeze for Backoff
impl RefUnwindSafe for Backoff
impl Send for Backoff
impl Sync for Backoff
impl Unpin for Backoff
impl UnsafeUnpin for Backoff
impl UnwindSafe for Backoff
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