pub struct RetryPolicy {
pub max_retries: u32,
pub base_delay_ms: u64,
pub max_delay_ms: u64,
}Expand description
Lightweight retry policy for HTTP wire clients.
Fields§
§max_retries: u32Maximum number of retries (not counting the initial attempt).
base_delay_ms: u64Base delay between retries in milliseconds.
max_delay_ms: u64Maximum delay cap in milliseconds.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn classify_anyhow(&self, error: &Error) -> RetryDecision
pub fn classify_anyhow(&self, error: &Error) -> RetryDecision
Classify an anyhow::Error for retry eligibility.
Uses the shared classify_anyhow_error classifier from
crate::error_category.
Sourcepub fn classify_status(&self, status: u16) -> RetryDecision
pub fn classify_status(&self, status: u16) -> RetryDecision
Classify an HTTP status code for retry eligibility.
Sourcepub fn delay_ms_for_attempt(&self, attempt: u32) -> u64
pub fn delay_ms_for_attempt(&self, attempt: u32) -> u64
Compute the backoff delay for a given attempt index (0-based).
Returns the delay in milliseconds, capped at max_delay_ms.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 moreSource§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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