Complete the code to declare an enum named Direction.
enum Direction {
[1],
South,
East,
West
}The enum Direction should have variants like North, South, East, and West to represent directions.
Complete the code to create a variable holding the enum variant East.
let go = Direction::[1];To assign the East variant of the Direction enum, use Direction::East.
Fix the error in the match statement to handle all Direction variants.
match go {
Direction::North => println!("Going north"),
Direction::South => println!("Going south"),
Direction::[1] => println!("Going east"),
Direction::West => println!("Going west"),
}The match statement must include Direction::East to handle the East variant.
Fill both blanks to define an enum with variants holding data.
enum Message {
Quit,
Move [1] i32 [2] i32 ),
Write(String),
}Tuple variants use parentheses and separate fields with commas.
Fill both blanks to create a function that returns a Message::Move variant.
fn create_move(x: i32, y: i32) -> Message {
Message::Move([1], [2])
}The function returns Message::Move with a tuple of x and y inside parentheses.
