From 0b56d7736412001b53eee13b2a9434921713bcc3 Mon Sep 17 00:00:00 2001 From: franklinblanco Date: Sat, 13 Aug 2022 16:45:02 -0400 Subject: [PATCH] Initial commit to test proc func macro --- .gitignore | 3 +++ Cargo.toml | 12 ++++++++++++ src/lib.rs | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3549fae --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +Cargo.lock +.env \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..373756a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "dev-macros" +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] +syn = "1.0" +quote = "1.0" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..d69ab87 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,12 @@ +use proc_macro::TokenStream; +use quote::{quote}; + + +#[proc_macro] +pub fn nigga(_input: TokenStream) -> TokenStream { + TokenStream::from(quote!( + fn deez() -> i32 { + 122 + } + )) +} \ No newline at end of file