pub struct Mutator<R: Rng> {
pub rng: R,
/* private fields */
}Expand description
Object which provides helper routines for mutating data structures and RNG management.
Fields§
§rng: RImplementations§
Source§impl<R: Rng> Mutator<R>
impl<R: Rng> Mutator<R>
pub fn new(rng: R) -> Mutator<R>
pub fn get_corpus_state(&self) -> CorpusFuzzingState
pub fn set_corpus_state(&mut self, state: CorpusFuzzingState)
Sourcepub fn gen<T>(&mut self) -> Twhere
T: NewFuzzed + 'static,
pub fn gen<T>(&mut self) -> Twhere
T: NewFuzzed + 'static,
Generates a random choice of the given type
Sourcepub fn mutate<T>(&mut self, num: &mut T)where
T: BitXor<Output = T> + Add<Output = T> + Sub<Output = T> + NumCast + Bounded + Copy + WrappingAdd<Output = T> + WrappingSub<Output = T> + DangerousNumber<T> + Debug,
pub fn mutate<T>(&mut self, num: &mut T)where
T: BitXor<Output = T> + Add<Output = T> + Sub<Output = T> + NumCast + Bounded + Copy + WrappingAdd<Output = T> + WrappingSub<Output = T> + DangerousNumber<T> + Debug,
Mutates a number after randomly selecting a mutation strategy (see [MutatorOperation] for a list of strategies) If a min/max is specified then a new number in this range is chosen instead of performing a bit/arithmetic mutation
Sourcepub fn gen_range<T, B1>(&mut self, min: B1, max: B1) -> Twhere
T: SampleUniform + Display,
B1: SampleBorrow<T> + Display + Add + Mul + NumCast + Sub + PartialEq + PartialOrd,
pub fn gen_range<T, B1>(&mut self, min: B1, max: B1) -> Twhere
T: SampleUniform + Display,
B1: SampleBorrow<T> + Display + Add + Mul + NumCast + Sub + PartialEq + PartialOrd,
Generates a number in the range from [min, max) (note: non-inclusive). Panics if min >= max.
Sourcepub fn gen_weighted_range<T, B1>(
&mut self,
min: B1,
max: B1,
weighted: Weighted,
) -> Twhere
T: SampleUniform + Display + NumCast,
B1: SampleBorrow<T> + Display + Debug + Add<Output = B1> + Mul<Output = B1> + NumCast + Sub<Output = B1> + PartialEq + PartialOrd + Copy + Div<Output = B1>,
pub fn gen_weighted_range<T, B1>(
&mut self,
min: B1,
max: B1,
weighted: Weighted,
) -> Twhere
T: SampleUniform + Display + NumCast,
B1: SampleBorrow<T> + Display + Debug + Add<Output = B1> + Mul<Output = B1> + NumCast + Sub<Output = B1> + PartialEq + PartialOrd + Copy + Div<Output = B1>,
Generates a number weighted to one end of the interval
Sourcepub fn should_early_bail_mutation(&self) -> bool
pub fn should_early_bail_mutation(&self) -> bool
Helper function for quitting the recursive mutation early if the target field has already been mutated.
Sourcepub fn gen_chance(&mut self, chance_percentage: f64) -> bool
pub fn gen_chance(&mut self, chance_percentage: f64) -> bool
Returns a boolean value indicating whether or not the chance event occurred
Sourcepub fn random_flags(&mut self)
pub fn random_flags(&mut self)
Client code should call this to signal to the mutator that a new fuzzer iteration is beginning and that the mutator should reset internal state.