I'm pretty sure there's a simple solution to my problem, but I'm not seeing it. Here is some simplified code similar to what I'm trying to get working:
enum Flower {
Daffodil(String),
Tulip(i32),
Rose(char),
}
fn main()
{
garden();
println!( "\n And we're done \n" );
}
fn garden() -> Flower {
let choice = 2;
match choice {
1 => {
println!("Daffodil");
Daffodil("This is a String".to_string())
}
2 => {
println!("\n Tulip");
Tulip(12)
}
3 => {
println!("Rose");
Rose('R')
}
_ => {}
}
}
The compiler complains with this error:
|
35 | _ => {}
| ^^ expected `Flower`, found `()`
How do I fix this?