pub struct RetryLayer<E, Sink = NullSink> { /* private fields */ }Expand description
Tower-native retry layer with optional telemetry.
Implementations§
Source§impl<E> RetryLayer<E, NullSink>
impl<E> RetryLayer<E, NullSink>
Sourcepub fn new(
max_attempts: usize,
backoff: Backoff,
jitter: Jitter,
should_retry: Arc<dyn Fn(&E) -> bool + Send + Sync>,
sleeper: Arc<dyn Sleeper>,
) -> Result<Self, BuildError>
pub fn new( max_attempts: usize, backoff: Backoff, jitter: Jitter, should_retry: Arc<dyn Fn(&E) -> bool + Send + Sync>, sleeper: Arc<dyn Sleeper>, ) -> Result<Self, BuildError>
Create a new retry layer with explicit configuration and no telemetry.
Most users should use RetryPolicy::builder() instead.
§Errors
Returns error if max_attempts is zero.
Trait Implementations§
Source§impl<E, Sink> Clone for RetryLayer<E, Sink>where
Sink: Clone,
impl<E, Sink> Clone for RetryLayer<E, Sink>where
Sink: Clone,
Source§impl<S, E, Sink> Layer<S> for RetryLayer<E, Sink>
impl<S, E, Sink> Layer<S> for RetryLayer<E, Sink>
Auto Trait Implementations§
impl<E, Sink = NullSink> !Freeze for RetryLayer<E, Sink>
impl<E, Sink = NullSink> !RefUnwindSafe for RetryLayer<E, Sink>
impl<E, Sink> Send for RetryLayer<E, Sink>where
Sink: Send,
impl<E, Sink> Sync for RetryLayer<E, Sink>where
Sink: Sync,
impl<E, Sink> Unpin for RetryLayer<E, Sink>where
Sink: Unpin,
impl<E, Sink = NullSink> !UnwindSafe for RetryLayer<E, Sink>
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