warlocks_cauldron/providers/
hardware.rs

1use super::dependencies::*;
2
3
4/// Methods collection for generate data related to hardware
5pub struct Hardware;
6
7impl Hardware {
8    /// Get a random screen resolution
9    pub fn resolution() -> &'static str {
10        get_random_element(RESOLUTIONS.iter())
11    }
12
13    /// Get a random size of screen in inch
14    pub fn screen_size() -> &'static str {
15        get_random_element(SCREEN_SIZES.iter())
16    }
17
18    /// Get a random CPU name
19    pub fn cpu() -> &'static str {
20        get_random_element(CPU.iter())
21    }
22
23    /// Get a random frequency of CPU
24    pub fn cpu_frequency() -> String {
25        format!("{:.1}GHz", uniform(1.5, 4.3))
26    }
27
28    /// Get a random generation
29    pub fn generation() -> &'static str {
30        get_random_element(GENERATION.iter())
31    }
32
33    /// Get a random CPU code name
34    pub fn cpu_codename() -> &'static str {
35        get_random_element(CPU_CODENAMES.iter())
36    }
37    
38    /// Get a random RAM type
39    pub fn ram_type() -> &'static str {
40        get_random_element(RAM_TYPES.iter())
41    }
42
43    /// Get a random size of RAM
44    pub fn ram_size() -> &'static str {
45        get_random_element(RAM_SIZES.iter())
46    }
47
48    /// Get a random value from list
49    pub fn ssd_or_hdd() -> &'static str {
50        get_random_element(HDD_SSD.iter())
51    }
52
53    /// Get a random graphics
54    pub fn graphics() -> &'static str {
55        get_random_element(GRAPHICS.iter())
56    }
57
58    /// Get a random manufacturer
59    pub fn manufacturer() -> &'static str {
60        get_random_element(MANUFACTURERS.iter())
61    }
62
63    /// Get a random phone model
64    pub fn phone_model() -> &'static str {
65        get_random_element(PHONE_MODELS.iter())
66    }
67}