Implement Group derive proc macro
This commit is contained in:
parent
a1acc26027
commit
1276a82e54
6 changed files with 117 additions and 32 deletions
|
|
@ -12,6 +12,8 @@
|
|||
use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
mod document;
|
||||
mod group;
|
||||
mod util;
|
||||
|
||||
#[proc_macro_derive(Document, attributes(document))]
|
||||
pub fn derive_document(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
|
|
@ -21,3 +23,12 @@ pub fn derive_document(input: proc_macro::TokenStream) -> proc_macro::TokenStrea
|
|||
Err(err) => err.into_compile_error().into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[proc_macro_derive(Group)]
|
||||
pub fn derive_group(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
match group::derive_impl(input) {
|
||||
Ok(tokens) => tokens.into(),
|
||||
Err(err) => err.into_compile_error().into(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue