linux_macros/
lib.rs

1extern crate proc_macro;
2
3mod pod;
4mod kstr;
5
6use proc_macro::{TokenStream};
7
8macro_rules! pod {
9    ($fn:ident, $name:ident, $internal:expr) => {
10        #[proc_macro_derive($name)]
11        pub fn $fn(input: TokenStream) -> TokenStream {
12            pod::derive(input, $internal)
13        }
14    }
15}
16
17pod!(pod, Pod, true);
18pod!(pod_pub, PodPub, false);
19
20macro_rules! kstr {
21    ($name:ident, $internal:expr) => {
22        #[proc_macro]
23        pub fn $name(input: TokenStream) -> TokenStream {
24            kstr::transform(input, $internal)
25        }
26    }
27}
28
29kstr!(kstr, true);
30kstr!(kstr_pub, false);