comlexr_macro 1.5.0

Dynamically build Command objects with conditional expressions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
macro_rules! enum_to_tokens {
    ($enum:ident: $($variant:ident),*) => {
        impl ToTokens for $enum {
            fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
                tokens.extend(match self {
                    $(Self::$variant(variant) => quote! { #variant },)*
                });
            }
        }
    };
}

pub(crate) use enum_to_tokens;