pub struct RetryPolicy { /* private fields */ }Expand description
Retry policy for executing operations with automatic retries
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(config: RetryConfig) -> Self
pub fn new(config: RetryConfig) -> Self
Create a new retry policy with the given configuration
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create a retry policy with default configuration
Sourcepub async fn execute<F, Fut, T, E>(
&self,
operation: F,
) -> Result<T, RetryError<E>>
pub async fn execute<F, Fut, T, E>( &self, operation: F, ) -> Result<T, RetryError<E>>
Execute an async operation with retry logic
Sourcepub fn execute_sync<F, T, E>(&self, operation: F) -> Result<T, RetryError<E>>
pub fn execute_sync<F, T, E>(&self, operation: F) -> Result<T, RetryError<E>>
Execute a synchronous operation with retry logic
Sourcepub async fn execute_with_condition<F, Fut, T, E, C>(
&self,
operation: F,
should_retry: C,
) -> Result<T, RetryError<E>>
pub async fn execute_with_condition<F, Fut, T, E, C>( &self, operation: F, should_retry: C, ) -> Result<T, RetryError<E>>
Execute with custom retry condition
Sourcepub fn config(&self) -> &RetryConfig
pub fn config(&self) -> &RetryConfig
Get the configuration
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more