pub struct RetryConfigBuilder { /* private fields */ }Expand description
Builder for RetryConfig
§Examples
Building a conservative retry policy for critical operations:
use chie_shared::RetryConfigBuilder;
let config = RetryConfigBuilder::new()
.max_attempts(10)
.initial_backoff_ms(1_000)
.max_backoff_ms(60_000)
.multiplier(2.0)
.enable_jitter(true)
.build();
assert_eq!(config.max_attempts, 10);
assert!(config.validate().is_ok());Implementations§
Source§impl RetryConfigBuilder
impl RetryConfigBuilder
Sourcepub const fn max_attempts(self, max: u32) -> Self
pub const fn max_attempts(self, max: u32) -> Self
Set maximum retry attempts
Sourcepub const fn initial_backoff_ms(self, ms: u64) -> Self
pub const fn initial_backoff_ms(self, ms: u64) -> Self
Set initial backoff delay
Sourcepub const fn max_backoff_ms(self, ms: u64) -> Self
pub const fn max_backoff_ms(self, ms: u64) -> Self
Set maximum backoff delay
Sourcepub const fn multiplier(self, multiplier: f64) -> Self
pub const fn multiplier(self, multiplier: f64) -> Self
Set backoff multiplier
Sourcepub const fn enable_jitter(self, enable: bool) -> Self
pub const fn enable_jitter(self, enable: bool) -> Self
Enable or disable jitter
Sourcepub const fn build(self) -> RetryConfig
pub const fn build(self) -> RetryConfig
Build the configuration
Trait Implementations§
Source§impl Debug for RetryConfigBuilder
impl Debug for RetryConfigBuilder
Source§impl Default for RetryConfigBuilder
impl Default for RetryConfigBuilder
Source§fn default() -> RetryConfigBuilder
fn default() -> RetryConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RetryConfigBuilder
impl RefUnwindSafe for RetryConfigBuilder
impl Send for RetryConfigBuilder
impl Sync for RetryConfigBuilder
impl Unpin for RetryConfigBuilder
impl UnwindSafe for RetryConfigBuilder
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