Skip to main content

Faults

Struct Faults 

Source
pub struct Faults { /* private fields */ }
Expand description

The armed set plus the run’s generator.

Implementations§

Source§

impl Faults

Source

pub fn none() -> Faults

Nothing armed but the weather that is always true: Fault::StaleVncPort is the provider’s normal behaviour, not an exception, and a mock that hid it by default would leave the toggle cure untested.

Source

pub fn quiet() -> Faults

Nothing at all, not even the provider’s normal. For the one test that asserts the mock can be quiet.

Source

pub fn seeded(seed: u64) -> Faults

Weather derived from one number. Every fault whose Fault::seeded_rate_per_mille is non-zero is armed, and fires at that rate off a stream derived from the seed and the fault’s own name — so adding a tenth fault does not renumber the other nine’s decisions, and a seed printed today still replays tomorrow.

Source

pub fn seed(&self) -> u64

Source

pub fn arm(&self, f: Fault)

Source

pub fn disarm(&self, f: Fault)

Source

pub fn is_armed(&self, f: Fault) -> bool

Source

pub fn fires(&self, f: Fault) -> bool

Ask whether f fires NOW. Deterministic when armed by name; seeded when the run has weather; sticky faults answer true forever once they have answered it once.

Source

pub fn fired(&self) -> Vec<Fault>

Everything that has fired at least once, for a run’s report line.

Trait Implementations§

Source§

impl Default for Faults

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.