Description
You can "cheese" enums3 by putting the test's desired values in the match statements:
match message {
Message::Resize { width, height } => self.resize(10, 30),
Message::ChangeColor(red, green, blue) => self.change_color(255, 0, 255),
Message::Quit => self.quit(),
Message::Move(Point) => self.move_position(Point),
Message::Echo(String) => self.echo(String),
}
This passes the test, albeit with a bunch of warnings about how the variables are unused.
Maybe add a second pass test to make sure the values are being passed through from state.process()
?
I also found that I had absolutely no idea why I would be using "r, g, b" over "red, green, blue" when these are not technically defined by me. Is this some function of structs/enums? Is it part of a standard library? Is it specific to rgb?
Also, maybe this exercise should take further advantage of match patterns? If the exercise's purpose is to teach match pattern syntax, I think maybe it should show off exhaustive match patterns as well. (Or maybe there should just be an entire exercise folder dedicated to match patterns, because this throws several new concepts at you at once.)
Hopefully I am not wasting time with this issue, I just found this exercise really confusing.