2020-09-17 20:21:21 +02:00
|
|
|
use strum::{EnumCount, EnumIter, IntoEnumIterator};
|
2018-11-05 19:36:09 +01:00
|
|
|
|
|
|
|
#[derive(Debug, EnumCount, EnumIter)]
|
|
|
|
enum Week {
|
|
|
|
Sunday,
|
|
|
|
Monday,
|
|
|
|
Tuesday,
|
|
|
|
Wednesday,
|
|
|
|
Thursday,
|
|
|
|
Friday,
|
|
|
|
Saturday,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn simple_test() {
|
2020-07-26 06:41:15 +02:00
|
|
|
assert_eq!(7, Week::COUNT);
|
|
|
|
assert_eq!(Week::iter().count(), Week::COUNT);
|
2018-11-05 19:36:09 +01:00
|
|
|
}
|
2021-07-17 05:40:19 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn crate_module_path_test() {
|
|
|
|
pub mod nested {
|
|
|
|
pub mod module {
|
|
|
|
pub use strum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, EnumCount, EnumIter)]
|
|
|
|
#[strum(crate = "nested::module::strum")]
|
|
|
|
enum Week {
|
|
|
|
Sunday,
|
|
|
|
Monday,
|
|
|
|
Tuesday,
|
|
|
|
Wednesday,
|
|
|
|
Thursday,
|
|
|
|
Friday,
|
|
|
|
Saturday,
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_eq!(7, Week::COUNT);
|
|
|
|
assert_eq!(Week::iter().count(), Week::COUNT);
|
|
|
|
}
|