1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use crate::{Dummy, Fake, Faker};
use rand::Rng;
impl<T, U> Dummy<U> for Option<T>
where
T: Dummy<U>,
{
fn dummy_with_rng<R: Rng + ?Sized>(config: &U, rng: &mut R) -> Self {
if Faker.fake_with_rng::<bool, _>(rng) {
Some(T::dummy_with_rng(config, rng))
} else {
None
}
}
}