Struct warlocks_cauldron::Address
source ยท pub struct Address(pub Locale);Expand description
Struct for generate fake address data.
This struct provides all the data related to geographical location.
Tuple Fieldsยง
ยง0: LocaleImplementationsยง
sourceยงimpl Address
impl Address
sourcepub fn street_number(&self) -> i32
pub fn street_number(&self) -> i32
Generate a random street number
return example: 666
sourcepub fn street_name(&self) -> &str
pub fn street_name(&self) -> &str
Get a random street name
return example: Lovecraft
sourcepub fn street_suffix(&self) -> &str
pub fn street_suffix(&self) -> &str
Get a random street suffix
return example: Hill
sourcepub fn address(&self) -> String
๐Deprecated since 0.0.0: use .local_address()
pub fn address(&self) -> String
Generate a random local address | An allias for .local_address() for compatibility with mimesis using
sourcepub fn local_address(&self) -> String
pub fn local_address(&self) -> String
Generate a random local address
return example: 666 Lovecraft Avenue
sourcepub fn full_address(&self) -> String
pub fn full_address(&self) -> String
Generate a random address including country name and state
return example: United States, Massachusetts, Innsmouth, 666 Lovecraft Avenue
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16
fn main() {
// A common option for most providers
let complex = ComplexProvider::new(Locale::EN);
println!("Person: {}", complex.person.full_name(None, false));
println!("Telephone: {}", complex.person.telephone(None));
println!("Address: {}", complex.address.full_address());
println!("Birthday: {}", Datetime::date(1940, 2000));
println!("Weight: {} kg", Person::weight(30, 90));
println!("Height: {} m", Person::height(1.5, 2.0));
// But you can also use single providers
let russian_person = Person(Locale::RU);
println!("Their Russian friend: {}", russian_person.full_name(None, false));
}More examples
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
fn main() {
println!("Address: {}", Address(Locale::EN).full_address());
println!("IMEI: {}", Code::imei());
println!("Mnemonic Phrase: {}", Cryptographic::mnemonic_phrase());
// start, end
println!("Datetime: {}", Datetime::datetime(1984, 2077));
println!("Filename: {}", File::file_name(None));
// scheme, tld, subdomains
println!("DSN: {}", Development::dsn(Some(DSNType::POSTGRES), Some(TLDType::CCTLD), Some(vec!["shop", "admin"])));
println!("Mac: {}", Internet::mac());
println!("Company: {}", Finance(Locale::EN).company());
println!("Drink: {}", Food(Locale::EN).drink());
println!("Manufacturer: {}", Hardware::manufacturer());
// sequence, length
println!("Choice: {:?}", Choice::pick(&vec!["a", "b", "c"], 5));
println!("Unique choice: {:?}", Choice::pick_unique(&vec!["a", "a", "b", "c"], 5));
// anything hashable object
println!("Increment a=1: {}", Numeric::increment("a"));
println!("Increment a+1: {}", Numeric::increment("a"));
println!("Increment 1=1: {}", Numeric::increment(1));
println!("Increment a+1: {}", Numeric::increment("a"));
println!("Project path: {}", Path::new(PlatformType::detect()).project_dir());
println!("Card struct: {:?}", Payment::credit_card());
// gender, reverse fullname
println!("Fullname: {}", Person(Locale::EN).full_name(Some(Gender::MALE), false));
println!("Telephone: {}", Person(Locale::EN).telephone(None));
println!("Username: {}", Person::username(Some("C.U.l.d"), Some((666, 777))));
// length of sequence
println!("DNA sequence: {}", Science::dna_sequence(10));
// words count
println!("Words: {:?}", Text(Locale::EN).words(5));
// None or Some(locale) for random or locale get transport code
println!("USA transport code: {}", Transport::vehicle_registration_code(Some(Locale::EN)));
}sourcepub fn continent(&self, code: bool) -> &str
pub fn continent(&self, code: bool) -> &str
Get a random continent name or continent code
return example: NA
Arguments
code- Return code of continent
sourcepub fn country_code(&self, code: Option<CountryCode>) -> Option<&str>
pub fn country_code(&self, code: Option<CountryCode>) -> Option<&str>
sourcepub fn country(&self, current_locale: bool) -> &str
pub fn country(&self, current_locale: bool) -> &str
Get the country of the current locale
return example: United States
Arguments
current_locale- Get country name by current locale
sourcepub fn state(&self, abbr: bool) -> &str
pub fn state(&self, abbr: bool) -> &str
Get a random administrative district of country
return example: Massachusetts
Arguments
abbr- Return ISO 3166-2 code
sourcepub fn region(&self, abbr: bool) -> &str
pub fn region(&self, abbr: bool) -> &str
Get a random region | An allias for .state()
return example: Massachusetts
Arguments
abbr- Return ISO 3166-2 code
sourcepub fn province(&self, abbr: bool) -> &str
pub fn province(&self, abbr: bool) -> &str
Get a random province | An allias for .state()
return example: Massachusetts
Arguments
abbr- Return ISO 3166-2 code
sourcepub fn federal_subject(&self, abbr: bool) -> &str
pub fn federal_subject(&self, abbr: bool) -> &str
Get a random region | An allias for .state()
return example: Massachusetts
Arguments
abbr- Return ISO 3166-2 code
sourcepub fn prefecture(&self, abbr: bool) -> &str
pub fn prefecture(&self, abbr: bool) -> &str
Get a random prefecture | An allias for .state()
return example: Massachusetts
Arguments
abbr- Return ISO 3166-2 code
sourcepub fn city(&self) -> &str
pub fn city(&self) -> &str
Get a random city
return example: Innsmouth
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let some_pool = RandomPool::new(vec![
"TEST", "test", "TeSt", "tEsT",
]);
println!("Something any: {}", some_pool.get());
let address_pool = RandomPool::new(vec![
Address(Locale::EN), Address(Locale::RU),
]);
println!("Random address: {}", address_pool.get().city());
let complex_pool = RandomPool::new(vec![
ComplexProvider::new(Locale::EN), ComplexProvider::new(Locale::RU),
]);
println!("Random complex provider: {}", complex_pool.get().person.name(Some(Gender::MALE)))
}sourcepub fn postal_code(&self) -> String
pub fn postal_code(&self) -> String
Generate a postal code for current locale
return example: 66613
sourcepub fn zip_code(&self) -> String
pub fn zip_code(&self) -> String
Generate a zip code | An allias for .postal_code()
return example: 66613
sourcepub fn calling_code(&self) -> &str
pub fn calling_code(&self) -> &str
Get a random calling code of random country
return example: +666
sourcepub fn latitude(dms: bool) -> FloatNumber
pub fn latitude(dms: bool) -> FloatNumber
Generate a random value of latitude
return example: 41ยบ14โ0.000โN
Arguments
abbr- Use DMS format
sourcepub fn longitude(dms: bool) -> FloatNumber
pub fn longitude(dms: bool) -> FloatNumber
Generate a random value of longitude
return example: 69ยบ56โ0.000โW
Arguments
abbr- Use DMS format
sourcepub fn coordinates(dms: bool) -> Coordinates
pub fn coordinates(dms: bool) -> Coordinates
Generate random geo coordinates
return example: Coordinates::DMS(โ41ยบ14โ0.000โNโ, โ69ยบ56โ0.000โWโ)
Arguments
abbr- Use DMS format