warlocks_cauldron/
enums.rs

1pub use valued_enums::*;
2
3use crate::data::{parser::ParsedData, parsed::*};
4
5
6/// This enum provides access to the supported locales from one place
7#[derive(Clone)]
8pub enum Locale {
9    #[cfg(feature = "cs")]
10    CS,
11
12    #[cfg(feature = "da")]
13    DA,
14
15    #[cfg(feature = "de")]
16    DE,
17
18    #[cfg(feature = "el")]
19    EL,
20
21    #[cfg(feature = "en")]
22    EN,
23
24    #[cfg(feature = "es")]
25    ES,
26
27    #[cfg(feature = "et")]
28    ET,
29
30    #[cfg(feature = "fa")]
31    FA,
32
33    #[cfg(feature = "fi")]
34    FI,
35
36    #[cfg(feature = "fr")]
37    FR,
38
39    #[cfg(feature = "hu")]
40    HU,
41
42    #[cfg(feature = "is")]
43    IS,
44
45    #[cfg(feature = "it")]
46    IT, 
47
48    #[cfg(feature = "ja")]
49    JA,
50
51    #[cfg(feature = "kk")]
52    KK,
53
54    #[cfg(feature = "ko")]
55    KO,
56
57    #[cfg(feature = "nl")]
58    NL,
59
60    #[cfg(feature = "no")]
61    NO,
62
63    #[cfg(feature = "pl")]
64    PL,
65
66    #[cfg(feature = "pt")]
67    PT,
68
69    #[cfg(feature = "ru")]
70    RU,
71
72    #[cfg(feature = "sk")]
73    SK,
74
75    #[cfg(feature = "sv")]
76    SV,
77
78    #[cfg(feature = "tr")]
79    TR,
80
81    #[cfg(feature = "uk")]
82    UK,
83
84    #[cfg(feature = "zh")]
85    ZH,
86}
87
88impl Locale {
89    pub fn get_data(&self) -> &'static ParsedData {
90        match self {
91            #[cfg(feature = "cs")]
92            Self::CS => &CS,
93        
94            #[cfg(feature = "da")]
95            Self::DA => &DA,
96        
97            #[cfg(feature = "de")]
98            Self::DE => &DE,
99        
100            #[cfg(feature = "el")]
101            Self::EL => &EL,
102        
103            #[cfg(feature = "en")]
104            Self::EN => &EN,
105    
106            #[cfg(feature = "es")]
107            Self::ES => &ES,
108        
109            #[cfg(feature = "et")]
110            Self::ET => &ET,
111        
112            #[cfg(feature = "fa")]
113            Self::FA => &FA,
114        
115            #[cfg(feature = "fi")]
116            Self::FI => &FI,
117        
118            #[cfg(feature = "fr")]
119            Self::FR => &FR,
120        
121            #[cfg(feature = "hu")]
122            Self::HU => &HU,
123        
124            #[cfg(feature = "is")]
125            Self::IS => &IS,
126        
127            #[cfg(feature = "it")]
128            Self::IT => &IT, 
129        
130            #[cfg(feature = "ja")]
131            Self::JA => &JA,
132        
133            #[cfg(feature = "kk")]
134            Self::KK => &KK,
135        
136            #[cfg(feature = "ko")]
137            Self::KO => &KO,
138        
139            #[cfg(feature = "nl")]
140            Self::NL => &NL,
141        
142            #[cfg(feature = "no")]
143            Self::NO => &NO,
144        
145            #[cfg(feature = "pl")]
146            Self::PL => &PL,
147        
148            #[cfg(feature = "pt")]
149            Self::PT => &PT,
150        
151            #[cfg(feature = "ru")]
152            Self::RU => &RU,
153        
154            #[cfg(feature = "sk")]
155            Self::SK => &SK,
156        
157            #[cfg(feature = "sv")]
158            Self::SV => &SV,
159        
160            #[cfg(feature = "tr")]
161            Self::TR => &TR,
162        
163            #[cfg(feature = "uk")]
164            Self::UK => &UK,
165        
166            #[cfg(feature = "zh")]
167            Self::ZH => &ZH, 
168        }
169    }
170}
171
172py_enum! {
173    /// Represents port ranges
174    PortRange((u16, u16)):
175        ALL = (1, 65535)
176        WELL_KNOWN = (1, 1023)
177        EPHEMERAL = (49152, 65535)
178        REGISTERED = (1024, 49151)
179}
180
181py_enum! {
182    /// Represents genders
183    #[derive(Copy, Clone, PartialEq, Eq)]
184    Gender(&'static str):
185        MALE = "male"
186        FEMALE = "female"
187}
188
189py_enum! {
190    /// Represents title types
191    #[derive(PartialEq, Eq)]
192    TitleType(&'static str):
193        TYPICAL = "typical"
194        ACADEMIC = "academic"
195}
196
197py_enum! {
198    /// Provides credit card types
199    #[derive(PartialEq, Eq)]
200    CardType(&'static str):
201        VISA = "Visa"
202        MASTER_CARD = "MasterCard"
203        AMERICAN_EXPRESS = "American Express"
204}
205
206py_enum! {
207    /// Provides algorithms which available
208    #[derive(PartialEq, Eq)]
209    Algorithm(&'static str):
210        MD5 = "md5"
211        SHA1 = "sha1"
212        SHA224 = "sha224"
213        SHA256 = "sha256"
214        SHA384 = "sha384"
215        SHA512 = "sha512"
216        BLAKE2B = "blake2b"
217        BLAKE2S = "blake2s"
218}
219
220py_enum! {
221    /// Provides top level domain types
222    TLDType(&'static str):
223        CCTLD = "cctld"
224        GTLD = "gtld"
225        GEOTLD = "geotld"
226        UTLD = "utld"
227        STLD = "stld"
228}
229
230py_enum! {
231    /// Provides file types
232    FileType(&'static str):
233        SOURCE = "source"
234        TEXT = "text"
235        DATA = "data"
236        AUDIO = "audio"
237        VIDEO = "video"
238        IMAGE = "image"
239        EXECUTABLE = "executable"
240        COMPRESSED = "compressed"
241}
242
243py_enum! {
244    /// Provides common mime types
245    MimeType(&'static str):
246        APPLICATION = "application"
247        AUDIO = "audio"
248        IMAGE = "image"
249        MESSAGE = "message"
250        TEXT = "text"
251        VIDEO = "video"
252}
253
254py_enum! {
255    /// Provides prefix signs
256    MetricPrefixSign(&'static str):
257        POSITIVE = "positive"
258        NEGATIVE = "negative"
259}
260
261py_enum! {
262    /// Provides types of country codes
263    CountryCode(&'static str):
264        A2 = "a2"
265        A3 = "a3"
266        NUMERIC = "numeric"
267        IOC = "ioc"
268        FIFA = "fifa"
269}
270
271py_enum! {
272    /// Provides formats of ISBN
273    ISBNFormat(&'static str):
274        ISBN13 = "isbn-13"
275        ISBN10 = "isbn-10"
276}
277
278py_enum! {
279    /// Provides formats of EAN
280    EANFormat(&'static str):
281        EAN8 = "ean-8"
282        EAN13 = "ean-13"
283}
284
285py_enum! {
286    /// Provide unit names
287    MeasureUnit((&'static str, &'static str)):
288        MASS = ("gram", "gr")
289        INFORMATION = ("byte", "b")
290        THERMODYNAMIC_TEMPERATURE = ("kelvin", "K")
291        AMOUNT_OF_SUBSTANCE = ("mole", "mol")
292        ANGLE = ("radian", "r")
293        SOLID_ANGLE = ("steradian", "㏛")
294        FREQUENCY = ("hertz", "Hz")
295        FORCE = ("newton", "N")
296        PRESSURE = ("pascal", "P")
297        ENERGY = ("joule", "J")
298        POWER = ("watt", "W")
299        FLUX= ("watt", "W")
300        ELECTRIC_CHARGE = ("coulomb", "C")
301        VOLTAGE = ("volt", "V")
302        ELECTRIC_CAPACITANCE = ("farad", "F")
303        ELECTRIC_RESISTANCE = ("ohm", "Ω")
304        ELECTRICAL_CONDUCTANCE = ("siemens", "S")
305        MAGNETIC_FLUX = ("weber", "Wb")
306        MAGNETIC_FLUX_DENSITY = ("tesla", "T")
307        INDUCTANCE = ("henry", "H")
308        TEMPERATURE = ("Celsius", "°C")
309        RADIOACTIVITY = ("becquerel", "Bq")
310}
311
312py_enum! {
313    /// Provides the number types
314    NumType(&'static str):
315        FLOAT = "floats"
316        INTEGER = "integers"
317        COMPLEX = "complexes"
318        DECIMAL = "decimals"
319}
320
321py_enum! {
322    /// Provides the vide file types
323    VideoFile(&'static str):
324        MP4 = "mp4"
325        MOV = "mov"
326}
327
328py_enum! {
329    /// Provides the audio file types
330    AudioFile(&'static str):
331        MP3 = "mp3"
332        AAC = "aac"
333}
334
335py_enum! {
336    /// Provides the image file types
337    ImageFile(&'static str):
338        JPG = "jpg"
339        PNG = "png"
340        GIF = "gif"
341}
342
343py_enum! {
344    /// Provides the document file types
345    DocumentFile(&'static str):
346        PDF = "pdf"
347        DOCX = "docx"
348        PPTX = "pptx"
349        XLSX = "xlsx"
350}
351
352py_enum! {
353    /// Provides the compressed file types
354    CompressedFile(&'static str):
355        ZIP = "zip"
356        GZIP = "gz"
357}
358
359py_enum! {
360    /// Provides URL schemes
361    URLScheme(&'static str):
362        WS = "ws"
363        WSS = "wss"
364        FTP = "ftp"
365        SFTP = "sftp"
366        HTTP = "http"
367        HTTPS = "https"
368}
369
370py_enum! {
371    /// Provides regions of timezones
372    TimezoneRegion(&'static str):
373        AFRICA = "Africa"
374        AMERICA = "America"
375        ANTARCTICA = "Antarctica"
376        ARCTIC = "Arctic"
377        ASIA = "Asia"
378        ATLANTIC = "Atlantic"
379        AUSTRALIA = "Australia"
380        EUROPE = "Europe"
381        INDIAN = "Indian"
382        PACIFIC = "Pacific"
383}
384
385py_enum! {
386    /// Provides URI and port of DSN
387    DSNType((&'static str, u16)):
388        POSTGRES = ("postgres", 5432)
389        MYSQL = ("mysql", 3306)
390        MONGODB = ("mongodb", 27017)
391        REDIS = ("redis", 6379)
392        COUCHBASE = ("couchbase", 8092)
393        MEMCACHED = ("memcached", 11211)
394        RABBITMQ = ("rabbitmq", 5672)
395}