with_simple_retry

Function with_simple_retry 

Source
pub async fn with_simple_retry<T, E, F, Fut>(
    max_retries: u32,
    operation: F,
) -> Result<T, E>
where F: FnMut() -> Fut, Fut: Future<Output = Result<T, E>>,
Expand description

Simple retry wrapper for operations that return Result with any error type

This version always retries on any error up to max_retries times. Use this when you don’t need fine-grained control over which errors are retryable.

§Example

use yldfi_common::with_simple_retry;

async fn flaky_operation() -> Result<String, std::io::Error> {
    Ok("success".to_string())
}

async fn example() {
    let result = with_simple_retry(3, flaky_operation).await;
}