#again #fail #retry #async #sync

tryagain

A library to try things again if they fail

1 unstable release

0.1.0 Jan 23, 2021

#9 in #again

Unlicense

11KB
159 lines

tryagain

A library to try things again if they fail.


lib.rs:

A crate for trying things again.

tryagain is a crate to try things again if they fail inspired by backoff that offers an easier way to cancel retry attemps and uses a non-blocking async implementation.

Sync example

fn fails() -> Result<(), i32> {
    Err(0)
}

// Will never resolve into, will spin forever.
let value = tryagain::retry(ImmediateBackoff, fails);

Async example

async fn fails() -> Result<(), i32> {
    Err(0)
}

// Will never resolve into, will spin forever.
let value = tryagain::future::retry(ImmediateBackoff, fails).await;

Dependencies

~0–10MB
~109K SLoC