faker_rust/default/
camera.rs1use crate::base::sample;
4use crate::locale::fetch_locale;
5
6pub fn brand() -> String {
8 fetch_locale("camera.brand", "en")
9 .map(|v| sample(&v))
10 .unwrap_or_else(|| "Canon".to_string())
11}
12
13pub fn model() -> String {
15 fetch_locale("camera.model", "en")
16 .map(|v| sample(&v))
17 .unwrap_or_else(|| "EOS 5D Mark IV".to_string())
18}
19
20pub fn brand_with_model() -> String {
22 fetch_locale("camera.brand_with_model", "en")
23 .map(|v| sample(&v))
24 .unwrap_or_else(|| format!("{} {}", brand(), model()))
25}
26
27#[cfg(test)]
28mod tests {
29 use super::*;
30
31 #[test]
32 fn test_brand_with_model() {
33 let b = brand_with_model();
34 assert!(!b.is_empty());
35 }
36}