Profile Options (#120)

* init profile settings

* more work

* finish everything

* Switch to index approach

* Fix settings str split

* Run lint
This commit is contained in:
Geometrically
2023-05-19 18:59:32 -07:00
committed by GitHub
parent 4df7605b8d
commit 6014172046
43 changed files with 1108 additions and 709 deletions

View File

@@ -6,31 +6,32 @@ use syn::{parse_macro_input, ItemFn};
#[proc_macro_attribute]
pub fn debug_pin(_attr: TokenStream, item: TokenStream) -> TokenStream {
// Parse the input tokens into a syntax tree
let input = parse_macro_input!(item as ItemFn);
let attrs = &input.attrs;
let vis = &input.vis; // visibility modifier
let sig = &input.sig; // function signature
let vis = &input.vis;
let sig = &input.sig;
let body = &input.block;
// Use cfg attribute for conditional compilation
// Generate tokens for the common part
let common_tokens = quote! {
#(#attrs)*
#vis #sig
};
let result = quote! {
#[cfg(debug_assertions)]
#(#attrs) *
#vis #sig {
#common_tokens {
Box::pin(async move {
#body
}).await
}
#[cfg(not(debug_assertions))]
#(#attrs) *
#vis #sig {
#common_tokens {
#body
}
};
// Hand the output tokens back to the compiler
TokenStream::from(result)
}