diff options
| author | Mica White <botahamec@outlook.com> | 2026-05-11 15:02:39 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-05-11 15:02:39 -0400 |
| commit | 3b3428d67ec465ee860c9cafcb10b99a2a2d37ec (patch) | |
| tree | 2bf302281eac38e1b6908519458a8e208505fa47 /varihappy-macros | |
| parent | c1e41f82bb071f1adcef293b277c3a44547d0679 (diff) | |
Simple macros
Diffstat (limited to 'varihappy-macros')
| -rw-r--r-- | varihappy-macros/Cargo.toml | 10 | ||||
| -rw-r--r-- | varihappy-macros/src/lib.rs | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/varihappy-macros/Cargo.toml b/varihappy-macros/Cargo.toml new file mode 100644 index 0000000..968ce85 --- /dev/null +++ b/varihappy-macros/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "varihappy-macros" +version = "0.1.0" +edition = "2024" + +[lib] +proc-macro = true + +[dependencies] +proc_macros = "0.1.0" diff --git a/varihappy-macros/src/lib.rs b/varihappy-macros/src/lib.rs new file mode 100644 index 0000000..561962c --- /dev/null +++ b/varihappy-macros/src/lib.rs @@ -0,0 +1,15 @@ +use proc_macro::{Ident, Span, TokenStream, TokenTree}; + +#[proc_macro] +pub fn concat_idents(input: TokenStream) -> TokenStream { + let mut buffer = String::new(); + for token in input { + if let TokenTree::Ident(identifier) = token { + buffer.push_str(&identifier.to_string()); + } + } + + let mut stream = TokenStream::new(); + stream.extend([Ident::new(&buffer, Span::call_site())]); + stream +} |
