Skip to main content

retry

Macro retry 

Source
macro_rules! retry {
    (attempts: $max:expr, backoff: $backoff:expr, $operation:expr) => { ... };
    ($max:expr, $operation:expr) => { ... };
}
Expand description

Retries an operation with configurable backoff.

§Semantics

let result = retry!(
    attempts: 3,
    backoff: exponential(100ms, 2.0),
    operation()
).await;
  • Retries up to max_attempts times
  • Waits delay between attempts (optionally with exponential backoff)
  • Returns first success, or last error after exhausting retries
  • Respects cancellation during both operation and delay