pub struct FailureSchedule { /* private fields */ }Expand description
A schedule that decides whether a given attempt fails.
Implementations§
Source§impl FailureSchedule
impl FailureSchedule
Sourcepub fn on_attempts(attempts: &[usize], mode: FailureMode) -> Self
pub fn on_attempts(attempts: &[usize], mode: FailureMode) -> Self
Build a schedule that fails on specific attempt numbers (1-indexed).
Sourcepub fn every_n(n: usize, mode: FailureMode) -> Self
pub fn every_n(n: usize, mode: FailureMode) -> Self
Build a schedule that fails on every Nth attempt (1-indexed).
Sourcepub fn maybe_fail(&self, attempt: usize) -> Result<(), InjectedFailure>
pub fn maybe_fail(&self, attempt: usize) -> Result<(), InjectedFailure>
Check whether the given attempt should fail. Returns Ok(())
if it should proceed, Err(InjectedFailure) otherwise.
Sourcepub fn invocation_count(&self) -> usize
pub fn invocation_count(&self) -> usize
Total invocations of maybe_fail since this schedule was built.
Auto Trait Implementations§
impl !Freeze for FailureSchedule
impl RefUnwindSafe for FailureSchedule
impl Send for FailureSchedule
impl Sync for FailureSchedule
impl Unpin for FailureSchedule
impl UnsafeUnpin for FailureSchedule
impl UnwindSafe for FailureSchedule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more