Interesting macro

This commit is contained in:
franklinblanco 2022-08-13 17:09:32 -04:00
parent 20dd8f1dee
commit de30a033ec
2 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[lib] [lib]
proc-macro = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]

View File

@ -1,10 +1,10 @@
use proc_macro::TokenStream;
use quote::{quote};
macro_rules! test_macro {
#[proc_macro] ($out_struct:path, $path:literal) => ( {
pub fn nigga(_input: TokenStream) -> TokenStream { println!($path);
TokenStream::from(quote!( });
122 }
))
fn _s() {
test_macro!(String, "a");
} }