cgp-macro-lib 0.7.0

Context-generic programming core component macros implemented as a library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use proc_macro2::TokenStream;
use quote::quote;
use syn::Ident;

pub fn define_substitution_macro(macro_name: &Ident, substitution: &TokenStream) -> TokenStream {
    quote! {
        #[macro_export]
        #[doc(hidden)]
        macro_rules! #macro_name {
            ( $( $body:tt )* ) => {
                replace_with! {
                    [ #substitution ],
                    $( $body )*
                }
            };
        }
    }
}