From e4ad766315879e1ff05bb111229f073f8f0ed68e Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Mon, 10 Oct 2022 21:30:02 +0200 Subject: 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. --- rust/src/implementation/pwm_macros.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 rust/src/implementation/pwm_macros.rs (limited to 'rust/src/implementation/pwm_macros.rs') 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 -- cgit v1.2.3