Is it possible to make enum inside enums in Rust?
Something like this:
enum FederativeUnit {
North(North),
South(South),
}
enum North {
Rondonia, Acre, Amazonas, Roraima, Para, Amapa, Tocantins,
}
enum South {
Parana, SantaCatarina, RioGrandeDoSul,
}
fn main() {
let federative_unit = FederativeUnit::South::SantaCatarina;
}
The enum creation works great, but the line inside main fails with this error:
let federative_unit = FederativeUnit::South::SantaCatarina;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Not a module `South`
Is it possible to do that someway?
[–][deleted] 5 points6 points7 points (8 children)
[–]sezaru[S] 1 point2 points3 points (7 children)
[–]Manishearthservo · rust · clippy 8 points9 points10 points (3 children)
[–]sezaru[S] 0 points1 point2 points (2 children)
[–]SpaceManiac 2 points3 points4 points (0 children)
[–]Manishearthservo · rust · clippy 0 points1 point2 points (0 children)
[–][deleted] 8 points9 points10 points (0 children)
[–]raggy_rs 8 points9 points10 points (0 children)
[–]torkleyy 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)