diff options
| author | Andreas Grois <andi@grois.info> | 2022-10-10 21:30:02 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2022-10-10 21:37:15 +0200 |
| commit | e4ad766315879e1ff05bb111229f073f8f0ed68e (patch) | |
| tree | 4b043ff47c78b2c00c80c94ebda622c32c8b6d3d /rust/src/implementation/pwm_macros.rs | |
PassFish: Initial Commit
Well, that's a lie. But nobody needs to see all the iterations I decided
to sweep under the rug.
That said, I think the repo is, while not clean, clean enough now, to
not be embarrassed by uploading it to github.
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 |
