Files
confique/macro/src/lib.rs
Lukas Kalbertodt 537a8b7725 Add version from other project
This was mostly what I implemented as utility library for another
project. But I figured I can also extract it as it's useful on its
own.
2021-04-29 18:09:26 +02:00

18 lines
368 B
Rust

use proc_macro::TokenStream as TokenStream1;
mod ast;
mod gen;
mod parse;
/// Defines a configuration in a special syntax. TODO: explain what this
/// generates.
#[proc_macro]
pub fn config(input: TokenStream1) -> TokenStream1 {
syn::parse2::<ast::Input>(input.into())
.map(gen::gen)
.unwrap_or_else(|e| e.to_compile_error())
.into()
}