I'm using some code that has generated structs and enums, and some of the enumerations are called Option. They are on their own module/crate but there seems to be a conflict with the std::option::Option.
The following does work (note Options, not Option as the name of the enum)
#[derive(strum_macros::EnumIter, Debug)]
pub enum Options {
Open,
Closed,
}
use strum::IntoEnumIterator;
fn main() {
for variant in crate::Options::iter() {
println!("The door is {:?}", variant);
}
}
the following does not work (the name of the enum is now Option)
#[derive(strum_macros::EnumIter, Debug)]
pub enum Option {
Open,
Closed,
}
use strum::IntoEnumIterator;
fn main() {
for variant in crate::Option::iter() {
println!("The door is {:?}", variant);
}
}
I'm using some code that has generated structs and enums, and some of the enumerations are called
Option
. They are on their own module/crate but there seems to be a conflict with the std::option::Option.The following does work (note Options, not Option as the name of the enum)
the following does not work (the name of the enum is now Option)