zebra_test::prelude::prop::option

Function weighted

pub fn weighted<T>(
    probability_of_some: impl Into<Probability>,
    t: T,
) -> OptionStrategy<T>
where T: Strategy,
Expand description

Return a strategy producing Optional values wrapping values from the given delegate strategy.

Some values shrink to None.

Some is chosen with a probability given by probability_of_some, which must be between 0.0 and 1.0, both exclusive.