pub fn with_catch<A, C, R>(
repetitions: usize,
delay: Duration,
repetitions_catch: usize,
catch: C,
assert: A,
) -> RExpand description
Run the provided function assert up to repetitions times with a delay in between tries.
Execute the provided function catch after repetitions_catch failed tries in order to trigger an alternate strategy.
Panics (including failed assertions) will be caught and ignored until the last try is executed.
§Examples
ⓘ
repeated_assert::with_catch(10, Duration::from_millis(50), 5,
|| {
// poke unreliable service
},
|| {
assert!(Path::new("should_appear_soon.txt").exists());
}
);§Info
See that.