Skip to main content

ReconnectPolicy

Trait ReconnectPolicy 

Source
pub trait ReconnectPolicy<E>:
    Sized
    + Clone
    + 'static {
    // Required method
    fn reconnect(&self, err: &E) -> bool;
}
Expand description

Decides whether a service error permits retrying or replacing a connection.

Cloneable Fn(&E) -> bool closures implement this trait. Factory initialization errors are converted to the service error type before the policy is consulted.

Required Methods§

Source

fn reconnect(&self, err: &E) -> bool

Returns whether err permits reconnection.

For creation or readiness errors, true permits another attempt if retry budget and backoff remain; false returns the error without retrying. A readiness-failed child is removed regardless of this decision.

For a call error from the current child, true invalidates readiness and schedules replacement on the next readiness check; false keeps the child. The failed request is never replayed. Errors from retired children do not consult the policy or invalidate a replacement.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<E> ReconnectPolicy<E> for DefaultPolicy

Source§

impl<T, E> ReconnectPolicy<E> for T
where T: Fn(&E) -> bool + Clone + 'static,