pub struct FailureInjector { /* private fields */ }Expand description
Stateful failure injector for tracking injection state.
Implementations§
Source§impl FailureInjector
impl FailureInjector
Sourcepub fn new(config: FailureConfig) -> Self
pub fn new(config: FailureConfig) -> Self
Create a new failure injector.
Sourcepub fn should_inject(&self) -> bool
pub fn should_inject(&self) -> bool
Check if a failure should be injected.
Sourcepub fn next_failure_type(&self) -> FailureType
pub fn next_failure_type(&self) -> FailureType
Get the next failure type.
Sourcepub fn inject(&self) -> Option<FailureType>
pub fn inject(&self) -> Option<FailureType>
Inject a failure and track it.
Sourcepub fn active_count(&self) -> u64
pub fn active_count(&self) -> u64
Get the number of active failures.
Sourcepub fn total_count(&self) -> u64
pub fn total_count(&self) -> u64
Get the total number of injected failures.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FailureInjector
impl !RefUnwindSafe for FailureInjector
impl Send for FailureInjector
impl Sync for FailureInjector
impl Unpin for FailureInjector
impl UnsafeUnpin for FailureInjector
impl UnwindSafe for FailureInjector
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