pub enum Policy {
Show 14 variants
Periodic(Duration),
Exponential {
base_delay: Duration,
factor: f64,
},
Fibonacci {
first: Duration,
second: Duration,
},
Immediate,
Never,
CountBox {
max_retries: u32,
inner: Box<Policy>,
},
TimeBox {
limit: Duration,
inner: Box<Policy>,
},
Clamp {
min_delay: Duration,
max_delay: Duration,
inner: Box<Policy>,
},
AddDelay {
delay: Duration,
inner: Box<Policy>,
},
Jitter {
factor: f64,
inner: Box<Policy>,
},
OnlyWhen {
predicate: Predicate,
inner: Box<Policy>,
},
AndThen(Box<Policy>, Box<Policy>),
Union(Box<Policy>, Box<Policy>),
Intersect(Box<Policy>, Box<Policy>),
}Expand description
High-level retry policy that keeps tree structure until conversion.
Variants§
Periodic(Duration)
Exponential
Fibonacci
Immediate
Never
CountBox
TimeBox
Clamp
AddDelay
Jitter
OnlyWhen
AndThen(Box<Policy>, Box<Policy>)
Union(Box<Policy>, Box<Policy>)
Intersect(Box<Policy>, Box<Policy>)
Implementations§
Source§impl Policy
impl Policy
pub fn immediate() -> Self
pub fn never() -> Self
pub fn periodic(delay: Duration) -> Self
pub fn exponential(base_delay: Duration, factor: f64) -> Self
pub fn fibonacci(first: Duration, second: Duration) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
pub fn within(self, limit: Duration) -> Self
pub fn clamp(self, min_delay: Duration, max_delay: Duration) -> Self
pub fn add_delay(self, delay: Duration) -> Self
pub fn with_jitter(self, factor: f64) -> Self
pub fn only_when(self, predicate: Predicate) -> Self
pub fn and_then(self, other: Policy) -> Self
pub fn union(self, other: Policy) -> Self
pub fn intersect(self, other: Policy) -> Self
pub fn try_to_raw(&self) -> Result<RetryPolicy, RetryBuilderError>
Trait Implementations§
Source§impl TryFrom<Policy> for RetryPolicy
impl TryFrom<Policy> for RetryPolicy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
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