You've already forked AstralRinth
forked from didirus/AstralRinth
* Code signing + auto updater * remove dist * update actions * fixes * fix more * commit * fix cache dir * quotes * fix hopefully? * why yaml * Fix cache dep path * Fix updating artifacts * fix ubuntu ver * enable autoupdater * fix pubkey * fix invalid config * pass in signing vars * update pubkey * Improve compile times
35 lines
729 B
Rust
35 lines
729 B
Rust
extern crate proc_macro;
|
|
|
|
use proc_macro::TokenStream;
|
|
use quote::quote;
|
|
use syn::{parse_macro_input, ItemFn};
|
|
|
|
#[proc_macro_attribute]
|
|
pub fn debug_pin(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(item as ItemFn);
|
|
|
|
let attrs = &input.attrs;
|
|
let vis = &input.vis;
|
|
let sig = &input.sig;
|
|
let body = &input.block;
|
|
|
|
#[cfg(debug_assertions)]
|
|
let result = quote! {
|
|
#(#attrs)*
|
|
#vis #sig {
|
|
Box::pin(async move {
|
|
#body
|
|
}).await
|
|
}
|
|
};
|
|
#[cfg(not(debug_assertions))]
|
|
let result = quote! {
|
|
#(#attrs)*
|
|
#vis #sig {
|
|
#body
|
|
}
|
|
};
|
|
|
|
TokenStream::from(result)
|
|
}
|