pub struct RetryPolicy { /* private fields */ }Expand description
Retry policy configuration
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn exponential(max_attempts: u32) -> Self
pub fn exponential(max_attempts: u32) -> Self
Create an exponential backoff retry policy
Delays increase exponentially: base_delay * 2^attempt
§Example
use lastfm_client::client::RetryPolicy;
let policy = RetryPolicy::exponential(3); // Max 3 retriesSourcepub fn linear(max_attempts: u32) -> Self
pub fn linear(max_attempts: u32) -> Self
Create a linear backoff retry policy
Delays increase linearly: base_delay * attempt
§Example
use lastfm_client::client::RetryPolicy;
let policy = RetryPolicy::linear(3); // Max 3 retriesSourcepub fn custom(
max_attempts: u32,
base_delay: Duration,
max_delay: Duration,
exponential: bool,
) -> Self
pub fn custom( max_attempts: u32, base_delay: Duration, max_delay: Duration, exponential: bool, ) -> Self
Create a custom retry policy
Sourcepub fn max_attempts(&self) -> u32
pub fn max_attempts(&self) -> u32
Get maximum number of attempts
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 · 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 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