zebra_test::prelude::prop::result

Function maybe_ok_weighted

pub fn maybe_ok_weighted<T, E>(
    probability_of_ok: impl Into<Probability>,
    t: T,
    e: E,
) -> MaybeOk<T, E>
where T: Strategy, E: Strategy,
Expand description

Create a strategy for Results where Ok values are taken from t and Err values are taken from e.

probability_of_ok is the probability (between 0.0 and 1.0, exclusive) that Ok is initially chosen.

Generated values shrink to Err.