Skip to main content

faker_rust/default/
educator.rs

1//! Educator generator - generates school and course names
2
3use crate::base::sample;
4use crate::locale::{fetch_locale, sample_with_resolve};
5
6/// Generate a random school name
7pub fn school_name() -> String {
8    fetch_locale("educator.school_name", "en")
9        .map(|v| sample(&v))
10        .unwrap_or_else(|| "Bluemeadow".to_string())
11}
12
13/// Generate a random university name (with placeholder resolution)
14pub fn university() -> String {
15    fetch_locale("educator.university", "en")
16        .map(|v| sample_with_resolve(&v, Some("educator")))
17        .unwrap_or_else(|| "Bluemeadow University".to_string())
18}
19
20/// Generate a secondary school name
21pub fn secondary_school() -> String {
22    fetch_locale("educator.secondary_school", "en")
23        .map(|v| sample_with_resolve(&v, Some("educator")))
24        .unwrap_or_else(|| "Bluemeadow High".to_string())
25}
26
27/// Generate a primary school name
28pub fn primary_school() -> String {
29    fetch_locale("educator.primary_school", "en")
30        .map(|v| sample_with_resolve(&v, Some("educator")))
31        .unwrap_or_else(|| "Bluemeadow Elementary School".to_string())
32}
33
34/// Generate a campus name
35pub fn campus() -> String {
36    fetch_locale("educator.campus", "en")
37        .map(|v| sample_with_resolve(&v, Some("educator")))
38        .unwrap_or_else(|| "Bluemeadow Campus".to_string())
39}
40
41/// Generate a random subject
42pub fn subject() -> String {
43    fetch_locale("educator.subject", "en")
44        .map(|v| sample(&v))
45        .unwrap_or_else(|| "Science".to_string())
46}
47
48/// Generate a degree
49pub fn degree() -> String {
50    fetch_locale("educator.degree", "en")
51        .map(|v| sample_with_resolve(&v, Some("educator")))
52        .unwrap_or_else(|| "Bachelor of Science".to_string())
53}
54
55/// Generate a course name
56pub fn course_name() -> String {
57    fetch_locale("educator.course_name", "en")
58        .map(|v| sample_with_resolve(&v, Some("educator")))
59        .unwrap_or_else(|| "Science 101".to_string())
60}
61
62/// Generate a university type (College, TAFE, etc.)
63pub fn university_type() -> String {
64    fetch_locale("educator.tertiary.university_type", "en")
65        .map(|v| sample(&v))
66        .unwrap_or_else(|| "University".to_string())
67}
68
69/// Generate a degree type (Associate Degree in, Bachelor of, etc.)
70pub fn degree_type() -> String {
71    fetch_locale("educator.tertiary.degree.type", "en")
72        .map(|v| sample(&v))
73        .unwrap_or_else(|| "Bachelor of".to_string())
74}