From 639f92bac3fac202c1e6a3c6a0367292b220500d Mon Sep 17 00:00:00 2001 From: xd009642 Date: Tue, 15 Aug 2023 17:49:41 +0100 Subject: [PATCH] Add in config tuple --- fake/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fake/src/lib.rs b/fake/src/lib.rs index 62a33e8..d439925 100644 --- a/fake/src/lib.rs +++ b/fake/src/lib.rs @@ -50,6 +50,12 @@ //! let words: Vec = Words(3..5).fake(); //! println!("words {:?}", words); //! +//! // Using a tuple config list to generate a vector with a length range and a specific faker for the element +//! let name_vec: Vec = (Name(EN), 3..5).fake(); +//! +//! // Using a macro as an alternative method for the tuple config list +//! let name_vec = fake::vec![String as Name(EN); 3..5]; +//! //! // using macro to generate nested collection //! let name_vec = fake::vec![String as Name(EN); 4, 3..5, 2]; //! println!("random nested vec {:?}", name_vec); @@ -65,7 +71,8 @@ //! println!("value from fixed seed {}", v); //! } //! -//! // Use an always true RNG so that optional types are always `Some` values. +//! // Use an always true RNG so that optional types are always `Some` values. (Requires +//! // always-true-rng feature). //! use fake::utils::AlwaysTrueRng; //! let mut rng = AlwaysTrueRng::default(); //! let result: Option = Faker.fake_with_rng(&mut rng);