pub struct Retry<T, E> { /* private fields */ }Expand description
Retry configuration: attempt cap, backoff, jitter, classification, budget.
Implementations§
Source§impl<T, E> Retry<T, E>
impl<T, E> Retry<T, E>
Sourcepub fn exponential() -> Self
pub fn exponential() -> Self
Exponential backoff (default 3 attempts, 100ms base, 10s max, no jitter).
Sourcepub fn standard() -> Self
pub fn standard() -> Self
Sensible default schedule: exponential + full jitter, 4 attempts.
Pair with .when(..) for transient-only classification (see spec §6).
pub fn max_attempts(self, n: u32) -> Self
pub fn max_elapsed(self, d: Duration) -> Self
pub fn base_delay(self, d: Duration) -> Self
pub fn max_delay(self, d: Duration) -> Self
pub fn jitter(self, j: Jitter) -> Self
Sourcepub fn budget(self, budget: RetryBudget) -> Self
pub fn budget(self, budget: RetryBudget) -> Self
Attach a shared RetryBudget to bound retries across calls.
pub fn when(self, pred: impl Fn(&E) -> bool + Send + Sync + 'static) -> Self
pub fn when_outcome( self, f: impl Fn(&Result<T, E>) -> RetryDecision + Send + Sync + 'static, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<T, E> !RefUnwindSafe for Retry<T, E>
impl<T, E> !UnwindSafe for Retry<T, E>
impl<T, E> Freeze for Retry<T, E>
impl<T, E> Send for Retry<T, E>
impl<T, E> Sync for Retry<T, E>
impl<T, E> Unpin for Retry<T, E>
impl<T, E> UnsafeUnpin for Retry<T, 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