From de30a033ec2832de518e266d22d5efeabc42c7ca Mon Sep 17 00:00:00 2001 From: franklinblanco Date: Sat, 13 Aug 2022 17:09:32 -0400 Subject: [PATCH] Interesting macro --- Cargo.toml | 1 - src/lib.rs | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 373756a..df70468 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" edition = "2021" [lib] -proc-macro = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/src/lib.rs b/src/lib.rs index ef703a3..4ef2ff0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ -use proc_macro::TokenStream; -use quote::{quote}; +macro_rules! test_macro { + ($out_struct:path, $path:literal) => ( { + println!($path); + }); +} -#[proc_macro] -pub fn nigga(_input: TokenStream) -> TokenStream { - TokenStream::from(quote!( - 122 - )) +fn _s() { + test_macro!(String, "a"); } \ No newline at end of file