pub struct RetryPolicy {
pub max_retries: u32,
pub base_wait_ms: u64,
pub max_wait_ms: u64,
pub backoff_factor: f64,
pub retryable_http_codes: HashSet<u16>,
pub max_retries_per_server: u32,
}Fields§
§max_retries: u32§base_wait_ms: u64§max_wait_ms: u64§backoff_factor: f64§retryable_http_codes: HashSet<u16>§max_retries_per_server: u32Implementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn new(max_retries: u32, base_wait_ms: u64) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_per_server(self, n: u32) -> Self
pub fn with_max_wait_ms(self, ms: u64) -> Self
Sourcepub fn max_tries(&self) -> u32
pub fn max_tries(&self) -> u32
Alias for max_retries for compatibility with the engine retry loop.
pub fn compute_wait(&self, attempt: u32) -> Option<Duration>
Sourcepub fn wait_duration(&self, attempt: u32) -> Duration
pub fn wait_duration(&self, attempt: u32) -> Duration
Compute wait duration using exponential backoff (Duration-based API).
This is equivalent to compute_wait but returns
a Duration directly, clamped between base_wait and max_wait.
Sourcepub fn should_retry(&self, attempt: u32, error: &Aria2Error) -> bool
pub fn should_retry(&self, attempt: u32, error: &Aria2Error) -> bool
Check whether a retry should be attempted based on the error type.
Returns true if the attempt count has not been exhausted and the
error is a recoverable Aria2Error.
pub fn should_retry_http(&self, status_code: u16) -> bool
pub fn should_retry_error(&self, error_str: &str) -> bool
pub fn is_exhausted(&self, attempts: u32) -> bool
pub fn total_estimated_wait_sec(&self) -> f64
pub fn stats(&self) -> RetryPolicyStats
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