Function retry_n

Source
pub fn retry_n<R, E>(
    max_tries: NonZeroU32,
    sleep_ms: u64,
    f: impl Fn() -> Result<R, E>,
) -> Result<R, E>
Expand description

Rerun f until it returns Ok or max_tries has run out. Sleeps a constant time between tries.