#[non_exhaustive]pub enum DataType {
Show 149 variants
Address,
FrenchAddress,
FrenchPostCode,
FrenchStreet,
Latitude,
LatitudeLongitude,
Longitude,
StreetNumber,
UkAddress,
UkPostCode,
HexColour,
HslaColour,
HslColour,
RgbaColour,
RgbColour,
DirPath,
FileName,
FilePath,
Ipv4,
Ipv6,
MacAddress,
Semver,
SemverStable,
SemverUnstable,
Bic,
Iban,
Isin,
RandomIsbn10,
RandomIsbn13,
FamousPerson,
CreditCard,
Email,
FrenchEmail,
FrenchLicencePlate,
FrenchPhoneNumber,
NhsNumber,
Password,
PhoneNumber,
SecuriteSociale,
UkLicencePlate,
UkPhoneNumber,
AlphanumericCapitalChar,
AlphanumericChar,
Boolean,
CapitalChar,
Digit,
LowerChar,
Number,
Sentence,
Paragraph,
Animal,
Mammal,
Bird,
Insect,
Fishe,
Amphibian,
Reptile,
Mollusc,
AnimalType,
MythologicalCreature,
LiteraryGenre,
ArchitecturalStyle,
MusicalGenre,
MusicalInstrument,
ColourName,
CurrencyName,
CurrencySymbol,
CurrencyCode,
DaysOfWeek,
Month,
DaysOfWeekAbbr,
MonthsAbbr,
TimeZone,
TimeUnit,
AmPm,
SchoolSubject,
AcademicDiscipline,
DegreesTitle,
University,
Sport,
FamousFrenchStreet,
FrenchRoadType,
FrenchCounty,
FrenchRiver,
HistoricalBattle,
EmailDomain,
OpenSourceApp,
TopLevelDomain,
UserAgent,
HttpStatusCode,
MimeType,
NameTitle,
FirstName,
FrenchFirstName,
FrenchLastName,
LastName,
Painter,
Writer,
Composer,
Mathematician,
Physician,
Biologist,
ComputerScientist,
Philosopher,
ProgrammingLanguage,
ProgrammingParadigm,
EditorColourTheme,
ItDomain,
FileExtension,
ChemicalElement,
MathematicalFunction,
TypesOfCloud,
Constellation,
Planet,
Star,
Galaxy,
UkCountyCode,
UkPostcodeArea,
UkCounty,
UkCity,
UkRoadType,
UkRiver,
UkStreet,
UsStateAbbr,
UsState,
UsRoad,
UsRoadType,
Word,
Job,
CompanyName,
ItCompanyName,
EnergyCompanyName,
FinanceCompanyName,
RetailCompanyName,
FoodCompanyName,
TravelCompanyName,
ConstructionCompanyName,
MediaCompanyName,
TelecomCompanyName,
BioCompanyName,
CarBrand,
AirDefenseCompanyName,
ClothingCompanyName,
Country,
City,
Continent,
CountryCode,
Street,
River,
}
Expand description
Representation of type that can be generated randomly.
There are two types of generated data: some are hard-coded with a list of possible values, others are produced by formulas. Both are usable the same way. If you don’t want to load all the possible values for all the types, you can choose to enable the data types you want (all features are enabled by default).
§Examples
use random_data::*;
let mut generator = DataGenerator::new();
#[cfg(feature = "datetime")]
{
let random_month = DataType::Month.random(&mut generator);
println!("{random_month}");
}
#[cfg(feature = "address")]
{
let random_address = DataType::Address.random(&mut generator);
println!("{random_address}");
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Address
FrenchAddress
FrenchPostCode
FrenchStreet
Latitude
LatitudeLongitude
Longitude
StreetNumber
UkAddress
UkPostCode
HexColour
HslaColour
HslColour
RgbaColour
RgbColour
DirPath
FileName
FilePath
Ipv4
Ipv6
MacAddress
Semver
SemverStable
SemverUnstable
Bic
Iban
Isin
RandomIsbn10
RandomIsbn13
FamousPerson
CreditCard
FrenchEmail
FrenchLicencePlate
FrenchPhoneNumber
NhsNumber
Password
PhoneNumber
SecuriteSociale
UkLicencePlate
UkPhoneNumber
AlphanumericCapitalChar
AlphanumericChar
Boolean
CapitalChar
Digit
LowerChar
Number
Sentence
Paragraph
Animal
Mammal
Bird
Insect
Fishe
Amphibian
Reptile
Mollusc
AnimalType
MythologicalCreature
LiteraryGenre
ArchitecturalStyle
MusicalGenre
MusicalInstrument
ColourName
CurrencyName
CurrencySymbol
CurrencyCode
DaysOfWeek
Month
DaysOfWeekAbbr
MonthsAbbr
TimeZone
TimeUnit
AmPm
SchoolSubject
AcademicDiscipline
DegreesTitle
University
Sport
FamousFrenchStreet
FrenchRoadType
FrenchCounty
FrenchRiver
HistoricalBattle
EmailDomain
OpenSourceApp
TopLevelDomain
UserAgent
HttpStatusCode
MimeType
NameTitle
FirstName
FrenchFirstName
FrenchLastName
LastName
Painter
Writer
Composer
Mathematician
Physician
Biologist
ComputerScientist
Philosopher
ProgrammingLanguage
ProgrammingParadigm
EditorColourTheme
ItDomain
FileExtension
ChemicalElement
MathematicalFunction
TypesOfCloud
Constellation
Planet
Star
Galaxy
UkCountyCode
UkPostcodeArea
UkCounty
UkCity
UkRoadType
UkRiver
UkStreet
UsStateAbbr
UsState
UsRoad
UsRoadType
Word
Job
CompanyName
ItCompanyName
EnergyCompanyName
FinanceCompanyName
RetailCompanyName
FoodCompanyName
TravelCompanyName
ConstructionCompanyName
MediaCompanyName
TelecomCompanyName
BioCompanyName
CarBrand
AirDefenseCompanyName
ClothingCompanyName
Country
City
Continent
CountryCode
Street
River
Implementations§
Source§impl DataType
impl DataType
Source§impl DataType
impl DataType
Sourcepub fn random(&self, generator: &mut DataGenerator) -> String
pub fn random(&self, generator: &mut DataGenerator) -> String
Sourcepub const fn values(&self) -> Option<&'static [&'static str]>
pub const fn values(&self) -> Option<&'static [&'static str]>
Returns the list of possible values of a data type if applicable
§Returns
- Some if the data type is defined by a list of values
- None if it is generated from a formula
§Examples
use random_data::*;
let mut generator = DataGenerator::new();
#[cfg(feature = "people")]
{
let mathematician = DataType::Mathematician.random(&mut generator);
let mathematicians = DataType::Mathematician.values().unwrap();
assert!(mathematicians.contains(&mathematician.as_ref()));
}
#[cfg(feature = "personal")]
assert!(DataType::Email.values().is_none());
Trait Implementations§
impl Copy for DataType
impl Eq for DataType
impl StructuralPartialEq for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
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