pub struct ComplexProvider<'a> {
pub address: Address<'a>,
pub date: Datetime<'a>,
pub finance: Finance<'a>,
pub food: Food<'a>,
pub person: Person<'a>,
pub text: Text<'a>,
}Expand description
Collection of every provider, which uses locales
Fieldsยง
ยงaddress: Address<'a>ยงdate: Datetime<'a>ยงfinance: Finance<'a>ยงfood: Food<'a>ยงperson: Person<'a>ยงtext: Text<'a>Implementationsยง
Sourceยงimpl<'a> ComplexProvider<'a>
impl<'a> ComplexProvider<'a>
Sourcepub fn new(locale: &'a Locale) -> Self
pub fn new(locale: &'a Locale) -> Self
Examples found in repository?
examples/pool.rs (line 17)
3fn main() {
4 let some_pool = RandomPool::new(vec![
5 "TEST", "test", "TeSt", "tEsT",
6 ]);
7
8 println!("Something any: {}", some_pool.get());
9
10 let address_pool = RandomPool::new(vec![
11 Address(&Locale::EN), Address(&Locale::RU),
12 ]);
13
14 println!("Random address: {}", address_pool.get().city());
15
16 let complex_pool = RandomPool::new(vec![
17 ComplexProvider::new(&Locale::EN), ComplexProvider::new(&Locale::RU),
18 ]);
19
20 println!("Random complex provider: {}", complex_pool.get().person.name(Some(Gender::MALE)))
21}More examples
examples/simple.rs (line 5)
3fn main() {
4 // A common option for most providers
5 let complex = ComplexProvider::new(&Locale::EN);
6 println!("Person: {}", complex.person.full_name(None, false));
7 println!("Telephone: {}", complex.person.telephone(None));
8 println!("Address: {}", complex.address.full_address());
9 println!("Birthday: {}", Datetime::date(1940, 2000));
10 println!("Weight: {} kg", Person::weight(30, 90));
11 println!("Height: {} m", Person::height(1.5, 2.0));
12
13 // But you can also use single providers
14 let russian_person = Person(&Locale::RU);
15 println!("Their Russian friend: {}", russian_person.full_name(Some(Gender::MALE), false));
16}Auto Trait Implementationsยง
impl<'a> Freeze for ComplexProvider<'a>
impl<'a> RefUnwindSafe for ComplexProvider<'a>
impl<'a> Send for ComplexProvider<'a>
impl<'a> Sync for ComplexProvider<'a>
impl<'a> Unpin for ComplexProvider<'a>
impl<'a> UnwindSafe for ComplexProvider<'a>
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more