medullah_web/macros/
enum_generate.rs

1#[macro_export]
2macro_rules! generate_enum {
3    // The macro takes the enum name and its variants as input
4    ($enum_name:ident { $($variant_name:ident $( ($variant_type:ty) )? ),* $(,)? }) => {
5        #[derive(strum_macros::EnumString, strum_macros::Display, Clone, Eq, PartialEq)]
6        #[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
7        pub enum $enum_name {
8            $(
9                $variant_name $( ($variant_type) )?,
10            )*
11        }
12
13        // Implement common traits for the enum
14        medullah_web::impl_enum_common_traits!($enum_name);
15    };
16}