Skip to main content

ReconnectSchedule

Trait ReconnectSchedule 

Source
pub trait ReconnectSchedule: Send {
    // Required method
    fn next_wait(&mut self, err: &ConnectError) -> Option<Duration>;
}
Expand description

The waits of one outage, from a ReconnectPolicy.

It is implemented for closures taking the &ConnectError and returning an Option<Duration>.

Required Methods§

Source

fn next_wait(&mut self, err: &ConnectError) -> Option<Duration>

Called after each failed reconnect attempt with its error: how long to wait before the next attempt, or None to stop reconnecting, after which every tunnel receives that error.

A wait under 1 ms is raised to 1 ms, and one over a day is reduced to a day. A Connector returning ConnectError::Canceled stops reconnecting without calling this. Closing the session stops reconnecting and cuts short a wait already started, but an attempt already under way when the session closes can still fail and call this.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§