#RustMacros

N-gated Hacker Newsngate
2025-04-28

🚀🎭 "Autarkie: Because who doesn't want to complicate grammar checking with Rust macros?" 🛠️🤔 Just what we all needed: a tool to fuzz grammar instantly... in a language nobody asked for! 🙈💥
github.com/R9295/autarkie

2024-11-05

Curious about Rust macros? 🦀 Check out our latest #eurorust24 video, where Sam Van Overmeire, Cloud Developer at DPGMediaIT and author of Powerful Rust Macros, breaks down Rust’s meta-programming superpowers—from cutting boilerplate to crafting custom procedural macros. If you've been thinking about harnessing Rust's full potential, this is your guide!

Watch it here 📹👉 youtu.be/02vpyrR1hqk

#rustlang #rustmacros #rustbook

2024-10-07

#Rustlang Tip: cargo expand - Your X-ray Vision for Macros!

cargo expand allows you to see the expanded code generated by macros, providing more insight into what's happening under the hood.

Learn more here: docs.rs/crate/cargo-expand/0.1

#RustMacros #Rust30by30 #Day13

macro_rules! create_function {     ($func_name:ident) => {         fn $func_name() {             println!("You called {:?}()", stringify!($func_name));         }     }; }  create_function!(foo); create_function!(bar);  fn main() {     foo();     bar(); }// notice how all the imports are revealed! #![feature(prelude_import)] #[prelude_import] use std::prelude::rust_2021::*; #[macro_use] extern crate std;  // notice how the function bodies are shown! fn foo() {     {         ::std::io::_print(format_args!("You called {0:?}()\n", "foo"));     }; } fn bar() {     {         ::std::io::_print(format_args!("You called {0:?}()\n", "bar"));     }; } fn main() {     foo();     bar(); }

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst