warlocks_cauldron/providers/
transport.rs

1use super::dependencies::*;
2
3
4/// Methods collection for generating data related to transports
5pub struct Transport;
6
7impl Transport {
8    /// Get a random car manufacturer
9    pub fn manufacturer() -> &'static str {
10        get_random_element(MANUFACTURERS.iter())
11    }
12
13    /// Get a random vehicle
14    pub fn car() -> &'static str {
15        get_random_element(CARS.iter())
16    }
17
18    /// Generate a dummy airplane model
19    pub fn airplane() -> &'static str {
20        get_random_element(AIRPLANES.iter())
21    }
22
23    /// Get vehicle registration code of country
24    /// 
25    /// # Arguments:
26    /// * `locale` - Registration code for locale (country)
27    pub fn vehicle_registration_code(locale: Option<Locale>) -> &'static str {
28        match locale {
29            Some(locale) => &VRC_BY_LOCALES.get(locale.get_data().lang_code.as_str()).unwrap(),
30            None => get_random_element(VR_CODES.iter())
31        }
32    }
33}