diff options
Diffstat (limited to 'rust/src/implementation/pwm_macros.rs')
| -rw-r--r-- | rust/src/implementation/pwm_macros.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rust/src/implementation/pwm_macros.rs b/rust/src/implementation/pwm_macros.rs new file mode 100644 index 0000000..158e4cd --- /dev/null +++ b/rust/src/implementation/pwm_macros.rs @@ -0,0 +1,27 @@ +extern crate passwordmaker_macros; +pub use self::passwordmaker_macros::*; + +pub trait EnumVariantCount { + fn variant_count() -> usize; +} + +#[cfg(test)] +mod pwm_macro_tests { + use super::*; + + #[allow(dead_code)] + enum Nest{ A, B } + #[allow(dead_code)] + #[derive(EnumVariantCount)] + enum TestNum { + A(usize), + B, + C(Nest), + D, + E{a : usize, b: f64} + } + #[test] + fn enum_variant_count_test(){ + assert_eq!(TestNum::variant_count(), 5); + } +}
\ No newline at end of file |
