Prologue: I'm at my first day on Rust here.
This is my demo code:
fn main() {
println!("Hello, world!");
println!(Move::X.to_string());
}
enum Move {
Empty,
X,
O,
}
impl Move {
fn to_string(&self) -> &'static str {
match self {
Move::Empty => "Empty",
Move::X => "X",
Move::O => "O"
}
}
}
This is not compiling because of these errors
I kindly ask you a fix, but mainly I need an explanation.
I tried
println!(String::from(Move::X.to_string()));
but the error is identical.