//! What the rigs need and none of them should spell its own way. Every //! fuzzer and measurement here is run by hand with its parameters in the //! environment, so one reader is shared rather than copied into each target. /// A rig's parameter from the environment, or its default. A switch is /// `env("NAME", 0_u8) != 0`, so `NAME=1` turns it on. pub fn env(name: &str, fallback: T) -> T { std::env::var(name) .ok() .and_then(|value| value.parse().ok()) .unwrap_or(fallback) } /// The seeds a scan runs: the one `one` names on its own, or `1..=` the /// count `many` gives. One seed replaces the range rather than narrowing /// it, which is how a tree a scan failed on is run again by itself. // This module is compiled into each rig target separately, so a helper the // measurement rigs have no seeds to choose is dead code in those builds. #[allow(dead_code)] pub fn seeds(one: &str, many: &str, count: u64) -> Vec { match std::env::var(one).ok().and_then(|seed| seed.parse().ok()) { Some(seed) => vec![seed], None => (1..=env(many, count)).collect(), } }