pub async fn retry_transient<F, Fut, T, E, P>(
operation: F,
policy: P,
) -> BoxedComposableResult<T, E>Expand description
Retries an async operation using Tokio’s sleep, returning a boxed error.
This is a convenience wrapper around retry_transient_unboxed that boxes
the error for reduced stack size.
§Arguments
operation- A closure that returns the future to retrypolicy- The retry policy to use
§Example
ⓘ
use error_rail::async_ext::{retry_transient, ExponentialBackoff};
#[tokio::main]
async fn main() {
let result = retry_transient(
|| fetch_data(),
ExponentialBackoff::default(),
).await;
}