pub struct When {
pub prob: f64,
pub seed: u64,
}Expand description
A seeded, deterministic stochastic gate.
fires(call_index) returns true with probability prob, derived purely
from (seed, call_index) — reproducible across runs, machines, and threads.
Wire it as a Filter predicate to drop/pass a fraction of calls, or reuse
it directly for sampling/canary/chaos decisions.
Fields§
§prob: f64Fire probability in [0, 1]. 0.0 never fires; 1.0 always fires.
seed: u64Seed pinning the fire sequence. Same (seed, prob) => same sequence.
Implementations§
Trait Implementations§
impl Copy for When
Source§impl<'de> Deserialize<'de> for When
impl<'de> Deserialize<'de> for When
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for When
Auto Trait Implementations§
impl Freeze for When
impl RefUnwindSafe for When
impl Send for When
impl Sync for When
impl Unpin for When
impl UnsafeUnpin for When
impl UnwindSafe for When
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