Skip to main content

RetryInterceptor

Trait RetryInterceptor 

Source
pub trait RetryInterceptor:
    Send
    + Sync
    + 'static {
    // Required method
    fn intercept(&self, err: &Error, dur: Duration);
}
Expand description

RetryInterceptor is used to intercept while retry happened.

Required Methods§

Source

fn intercept(&self, err: &Error, dur: Duration)

Everytime RetryLayer is retrying, this function will be called.

§Timing

just before the retry sleep.

§Inputs
  • err: The error that caused the current retry.
  • dur: The duration that will sleep before next retry.
§Notes

The intercept must be quick and non-blocking. No heavy IO is allowed. Otherwise, the retry will be blocked.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> RetryInterceptor for F
where F: Fn(&Error, Duration) + Send + Sync + 'static,