pub struct RetryPolicy { /* private fields */ }Expand description
Exponential-backoff settings for replayable provider HTTP operations.
The policy applies only to request shapes that the Kit marks safe to replay, and every retry still runs inside the same shared logical request deadline.
§Examples
let policy = providers_kit::config::RetryPolicy::default();
let _ = policy;Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(
max_retries: u32,
initial_backoff: Duration,
max_backoff: Duration,
) -> Result<Self, KitError>
pub fn new( max_retries: u32, initial_backoff: Duration, max_backoff: Duration, ) -> Result<Self, KitError>
Creates validated replay-safe retry policy.
§Errors
Returns a configuration error when retries are enabled with zero initial backoff, or the maximum backoff is shorter than the initial backoff.
§Examples
use providers_kit::config::RetryPolicy;
use std::time::Duration;
let disabled = RetryPolicy::new(0, Duration::ZERO, Duration::ZERO)?;
assert_ne!(disabled, RetryPolicy::default());
assert!(RetryPolicy::new(1, Duration::ZERO, Duration::from_secs(1)).is_err());
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
impl Eq for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.