Skip to content

Commit 62401d8

Browse files
committed
Update enums exercise: define Message enum with variants Resize, Move, Echo, ChangeColor, and Quit. Modify .rustlings-state.txt to reflect the addition of enums2 and the inclusion of enums1.
1 parent f1332a0 commit 62401d8

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

.rustlings-state.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DON'T EDIT THIS FILE!
22

3-
enums1
3+
enums2
44

55
intro1
66
intro2
@@ -34,4 +34,5 @@ move_semantics4
3434
move_semantics5
3535
structs1
3636
structs2
37-
structs3
37+
structs3
38+
enums1

exercises/08_enums/enums1.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#[derive(Debug)]
22
enum Message {
33
// TODO: Define a few types of messages as used below.
4+
Resize,
5+
Move,
6+
Echo,
7+
ChangeColor,
8+
Quit,
49
}
510

611
fn main() {

solutions/08_enums/enums1.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
#[derive(Debug)]
2+
enum Message {
3+
Resize,
4+
Move,
5+
Echo,
6+
ChangeColor,
7+
Quit,
8+
}
9+
110
fn main() {
2-
// DON'T EDIT THIS SOLUTION FILE!
3-
// It will be automatically filled after you finish the exercise.
11+
println!("{:?}", Message::Resize);
12+
println!("{:?}", Message::Move);
13+
println!("{:?}", Message::Echo);
14+
println!("{:?}", Message::ChangeColor);
15+
println!("{:?}", Message::Quit);
416
}

0 commit comments

Comments
 (0)