Crate warlocks_cauldron
source ·Expand description
🧙♀️ Warlock’s Cauldron
🦀 Fake Data Generator written in Rust - fully inspired by https://mimesis.name 🐍
Installation
All localizations are enabled by default feature, you can specify localizations in features!
[dependencies.warlocks-cauldron]
version = "0.26.9"
# git = "https://github.com/hack-wrench/warlocks-cauldron"
# features = ["en"] # For example to use only english localization
Supported languages
There are currently 26 languages available: cs, da, de, el, en, es, et, fa, fi, fr, hu, is, it, ja, kk, ko, nl, no, pl, pt, ru, sk, sv, tr, uk, zh
Supported providers
There are currently 18 providers available: Address, Choice, Code, Cryptographic, Date, Development, File, Finance, Food, Hardware, Internet, Numeric, Path, Payment, Person, Science, Text, Transport
Examples
Visit /examples
for detailed examples. In the process of development it was decided to make the workflow as close to mimesis as possible, most of the methods and namespace were taken from there.
use warlocks_cauldron::*;
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(Some(Gender::MALE), false));
}
License
This project is licensed under the GPL-3.0 license
Macros
Structs
- Struct for generate fake address data.
- Provides algorithms which available
- Provides the audio file types
- Methods collection provides special data for Brazil (pt-br)
- Provides credit card types
- Methods collection for generating a random choice from items in a sequence
- Methods collection which provides methods for generating codes
- Collection of every provider, which uses locales
- Provides the compressed file types
- Provides types of country codes
- Methods collection that provides cryptographic data
- Provides URI and port of DSN
- ISO 8601 combined date and time with time zone.
- Struct for generating data related to the date and time
- Methods collection provides special data for Denmark (da)
- Methods collection for getting fake data for Developers
- Provides the document file types
- ISO 8601 time duration with nanosecond precision. This also allows for the negative duration; see individual methods for details.
- Provides formats of EAN
- Methods collection for generate data related to files
- Provides file types
- A struct for generating finance data
- Struct for generating data related to food
- Represents genders
- Methods collection for generate data related to hardware
- Provides formats of ISBN
- Provides the image file types
- Methods collection for generating data related to the internet
- Methods collection provides special data for Italy (it)
- The local timescale. This is implemented via the standard
time
crate. - Provide unit names
- Provides prefix signs
- Provides common mime types
- ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
- Methods collection provides special data for Netherlands (nl)
- Provides the number types
- Methods collection for generate any numeric values
- Methods collection that provides methods and property for generate paths
- Methods collection for generating data related to payments
- Struct for generating personal data
- Methods collection provides special data for Poland (pl)
- Represents port ranges
- Methods collection provides special data for Russia (ru)
- Methods collection for generating pseudo-scientific data
- Provides top level domain types
- A struct for generating text data
- Provides regions of timezones
- Represents title types
- Methods collection for generating data related to transports
- Provides URL schemes
- Methods collection provides special data for USA (en)
- Methods collection provides special data for Ukraine (uk)
- The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
- Provides the vide file types
Enums
- This enum provides access to the supported locales from one place
- Enum for init path-gen struct
Traits
- The common set of methods for date component.