Skip to content

Commit 7601e0c

Browse files
authored
Merge pull request #1828 from samypr100/patch-1
Update enum_use.md to use a more neutral theme
2 parents e093099 + 015ec84 commit 7601e0c

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/custom_types/enum/enum_use.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@ The `use` declaration can be used so manual scoping isn't needed:
66
// An attribute to hide warnings for unused code.
77
#![allow(dead_code)]
88
9-
enum Status {
10-
Rich,
11-
Poor,
9+
enum Stage {
10+
Beginner,
11+
Advanced,
1212
}
1313
14-
enum Work {
15-
Civilian,
16-
Soldier,
14+
enum Role {
15+
Student,
16+
Teacher,
1717
}
1818
1919
fn main() {
2020
// Explicitly `use` each name so they are available without
2121
// manual scoping.
22-
use crate::Status::{Poor, Rich};
23-
// Automatically `use` each name inside `Work`.
24-
use crate::Work::*;
22+
use crate::Stage::{Beginner, Advanced};
23+
// Automatically `use` each name inside `Role`.
24+
use crate::Role::*;
2525
26-
// Equivalent to `Status::Poor`.
27-
let status = Poor;
28-
// Equivalent to `Work::Civilian`.
29-
let work = Civilian;
26+
// Equivalent to `Stage::Beginner`.
27+
let stage = Beginner;
28+
// Equivalent to `Role::Student`.
29+
let role = Student;
3030
31-
match status {
31+
match stage {
3232
// Note the lack of scoping because of the explicit `use` above.
33-
Rich => println!("The rich have lots of money!"),
34-
Poor => println!("The poor have no money..."),
33+
Beginner => println!("Beginners are starting their learning journey!"),
34+
Advanced => println!("Advanced learners are mastering their subjects..."),
3535
}
3636
37-
match work {
37+
match role {
3838
// Note again the lack of scoping.
39-
Civilian => println!("Civilians work!"),
40-
Soldier => println!("Soldiers fight!"),
39+
Student => println!("Students are acquiring knowledge!"),
40+
Teacher => println!("Teachers are spreading knowledge!"),
4141
}
4242
}
4343
```

0 commit comments

Comments
 (0)