#[non_exhaustive]pub struct FaultConfig {
pub command: String,
pub fault_type: FaultType,
pub trigger_count: u64,
pub max_triggers: u64,
pub created_at: Instant,
}Expand description
Configuration for a single fault injection rule.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.command: StringTarget command name.
fault_type: FaultTypeType of fault to inject.
trigger_count: u64Number of times this fault has been triggered.
max_triggers: u64Maximum number of times to trigger (0 = unlimited).
created_at: InstantWhen this fault was created.
Implementations§
Source§impl FaultConfig
impl FaultConfig
Sourcepub fn new(
command: impl Into<String>,
fault_type: FaultType,
max_triggers: u64,
) -> Self
pub fn new( command: impl Into<String>, fault_type: FaultType, max_triggers: u64, ) -> Self
Creates a fault rule for command, created now with zero triggers so far.
max_triggers == 0 means unlimited (until FAULT_TTL expires it).
Sourcepub fn should_trigger_at(&self, now: Instant) -> bool
pub fn should_trigger_at(&self, now: Instant) -> bool
Whether this fault should still trigger, evaluated at now. A fault is
inert once it is older than FAULT_TTL or has hit max_triggers.
Sourcepub fn should_trigger(&self) -> bool
pub fn should_trigger(&self) -> bool
Check if this fault should still trigger right now.
Trait Implementations§
Source§impl Clone for FaultConfig
impl Clone for FaultConfig
Source§impl Debug for FaultConfig
impl Debug for FaultConfig
Auto Trait Implementations§
impl Freeze for FaultConfig
impl RefUnwindSafe for FaultConfig
impl Send for FaultConfig
impl Sync for FaultConfig
impl Unpin for FaultConfig
impl UnsafeUnpin for FaultConfig
impl UnwindSafe for FaultConfig
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