i have an enum which has two members
enum WhoMove {
Left,
Right,
}
i want just use a method like wm.turn_over() to turn over the wm, such as if the wm is WhoMove::Right, i hope that after used the method wm.turn_over, the wm will become WhoMove::Lift.
here is my code, but it can't work
enum WhoMove {
Left,
Right,
}
impl WhoMove {
fn turn_over(&mut self) {
// match self {
// WhoMove::Left => self = &mut WhoMove::Right,
// WhoMove::Right => self = &mut WhoMove::Left,
// }
}
}
Thank u for help!