randomizer/helpers/
local_macros.rs

1#[macro_export]
2macro_rules! automated_impl {
3    (
4        $(
5            $(#[$docs:meta])*
6            ($konst:ident);
7        )+
8    ) => {
9        $(
10            $(#[$docs])*
11            #[doc = " ```\n" ]
12            #[doc = " use randomizer::Randomizer;\n"]
13            #[doc = " \n" ]
14            #[doc = concat!(" let randomized = Randomizer::", stringify!($konst), "(12);\n") ]
15            #[doc = " \n" ]
16            #[doc = concat!(" assert_eq!(randomized.string().unwrap().chars().count(), 12);\n") ]
17            #[doc = " ``` "]
18            #[allow(non_snake_case)]
19             pub fn $konst(length: usize) -> Self {
20                Self::new(length, Some(constants::$konst))
21            }
22        )+
23    }
24}
25
26pub(crate) use automated_impl;