Crabtime
lastmod 2025-03-26created 2025-03-261 edits
Let's use Zig's Comptime in Rust
Features
- A macro that evaluates inline Rust logic at compile time to generate and add new code
- Offers more flexibility and performance than Procedural macros, while being easier and more natural to read and write than macro_rules
- Supports Token Stream/Macro Fragments/Rust code for both Input and Output
- IDE support, code formatting, and inline definitions are possible, with excellent readability
- One-shot eval : complex compile-time computations can be handled simply
- Function-like macros (Function-like Macros)
- Function-like macros can be defined with #[crabtime::function]
- Defined functions are converted into macros and executed at build time
- Macros can be exported using the standard #[macro_export] attribute