use fake::{Dummy, Fake, Faker, Opt, Optional}; #[derive(Debug, Dummy)] pub struct Order { #[dummy(faker = "0..200")] pub a: Option, #[dummy(faker = "Opt(0..200, 100)", from = "Optional")] pub always_some: Option, #[dummy(expr = "Some((0..200).fake())")] pub always_some_v2: Option, #[dummy(faker = "Opt(0..200, 0)", from = "Optional")] pub always_none: Option, #[dummy(expr = "None")] pub always_none_v2: Option, #[dummy(faker = "0..200")] pub c: Option>, #[dummy(expr = "Opt(Opt(0..200, 50), 50).fake::>>().0.map(|v| v.0)")] pub d: Option>, } fn main() { let opt: Optional = Opt(0..100, 100).fake(); println!("{:?}", opt); let opt: Optional> = Opt(Opt(0..200, 50), 20).fake(); println!("{:?}", opt.0.map(|v| v.0)); let opt: Option = Opt(0..100, 100).fake::>().into(); println!("{:?}", opt); let o: Order = Faker.fake(); println!("{:?}", o); }