I'm trying to use an enum
but I need string values to be saved in DB, Redis etc.
pub enum Place {
Square = "1",
House = "2",
Office = "3",
// and so on... Garage = "4",
}
But the compiler throws with:
error[E0308]: mismatched types
|
3 | Square = "1",
| ^^^ expected `isize`, found `&str`
error[E0308]: mismatched types
|
4 | House = "2",
| ^^^ expected `isize`, found `&str`
error[E0308]: mismatched types
|
5 | Office = "3",
| ^^^ expected `isize`, found `&str`
For more information about this error, try `rustc --explain E0308`.
Why?
What does it mean?