pub struct RetryConfig {
pub enabled: bool,
pub max_retries: u32,
pub initial_delay: Duration,
pub max_delay: Duration,
pub backoff_multiplier: f32,
}Available on crate features
models and gemini only.Expand description
Configuration for automatic retry with exponential backoff.
Fields§
§enabled: boolWhether retries are enabled.
max_retries: u32Maximum number of retry attempts before giving up.
initial_delay: DurationInitial delay before the first retry.
max_delay: DurationMaximum delay between retries (caps exponential growth).
backoff_multiplier: f32Multiplier applied to the delay after each retry.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn disabled() -> RetryConfig
pub fn disabled() -> RetryConfig
Create a disabled retry configuration (no retries).
Sourcepub fn with_max_retries(self, max_retries: u32) -> RetryConfig
pub fn with_max_retries(self, max_retries: u32) -> RetryConfig
Set the maximum number of retry attempts.
Sourcepub fn with_initial_delay(self, initial_delay: Duration) -> RetryConfig
pub fn with_initial_delay(self, initial_delay: Duration) -> RetryConfig
Set the initial delay before the first retry.
Sourcepub fn with_max_delay(self, max_delay: Duration) -> RetryConfig
pub fn with_max_delay(self, max_delay: Duration) -> RetryConfig
Set the maximum delay between retries.
Sourcepub fn with_backoff_multiplier(self, backoff_multiplier: f32) -> RetryConfig
pub fn with_backoff_multiplier(self, backoff_multiplier: f32) -> RetryConfig
Set the backoff multiplier applied after each retry.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
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 RetryConfig
impl Debug for RetryConfig
Source§impl Default for RetryConfig
impl Default for RetryConfig
Source§fn default() -> RetryConfig
fn default() -> RetryConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnsafeUnpin for RetryConfig
impl UnwindSafe for RetryConfig
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