pub struct RetryLayer<E> { /* private fields */ }Expand description
A Tower Layer that applies retry logic to a service.
This layer wraps a service with retry middleware that automatically retries failed requests according to the configured policy.
§Examples
use tower_retry_plus::RetryConfig;
use tower::ServiceBuilder;
use std::time::Duration;
let retry_layer: tower_retry_plus::RetryLayer<MyError> = RetryConfig::builder()
.max_attempts(5)
.exponential_backoff(Duration::from_millis(100))
.build()
.layer();
let service = ServiceBuilder::new()
.layer(retry_layer)
.service(my_service());Implementations§
Source§impl<E> RetryLayer<E>
impl<E> RetryLayer<E>
Sourcepub fn new(config: RetryConfig<E>) -> Self
pub fn new(config: RetryConfig<E>) -> Self
Creates a new RetryLayer with the given configuration.
Trait Implementations§
Source§impl<E: Clone> Clone for RetryLayer<E>
impl<E: Clone> Clone for RetryLayer<E>
Source§fn clone(&self) -> RetryLayer<E>
fn clone(&self) -> RetryLayer<E>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<E> Freeze for RetryLayer<E>
impl<E> !RefUnwindSafe for RetryLayer<E>
impl<E> Send for RetryLayer<E>
impl<E> Sync for RetryLayer<E>
impl<E> Unpin for RetryLayer<E>
impl<E> UnsafeUnpin for RetryLayer<E>
impl<E> !UnwindSafe for RetryLayer<E>
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