@@ -6,38 +6,38 @@ The `use` declaration can be used so manual scoping isn't needed:
6
6
// An attribute to hide warnings for unused code.
7
7
#![allow(dead_code)]
8
8
9
- enum Status {
10
- Rich ,
11
- Poor ,
9
+ enum Stage {
10
+ Beginner ,
11
+ Advanced ,
12
12
}
13
13
14
- enum Work {
15
- Civilian ,
16
- Soldier ,
14
+ enum Role {
15
+ Student ,
16
+ Teacher ,
17
17
}
18
18
19
19
fn main() {
20
20
// Explicitly `use` each name so they are available without
21
21
// 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 ::*;
25
25
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 ;
30
30
31
- match status {
31
+ match stage {
32
32
// 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 ..."),
35
35
}
36
36
37
- match work {
37
+ match role {
38
38
// 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 !"),
41
41
}
42
42
}
43
43
```
0 commit comments