buns-0.1.1 has been yanked.
A simple way to write repeatable code anywhere, by defining buns and toppings. 🍞
Sandwich / Compose
This can be seen as format!(), but for code:
- Buns: Write the code, use
^0 ^1 .. ^Nas (Topping) placeholders - Topping: Write code inserts:
#0^1^..^N, where numbers = any code - Why tho? The point is, you can repeat 2. and make infinite sandwiches. 🥪
sandwich!
// Will generate:
// const TEST: u32 = 10;
// const OMEGA: u32 = 59;
Prepare / Preset
This can be seen as a simplified macro_rules!{}, where you prepare named Buns and add the Toppings later using the generated macro (The code (Buns) is automatically added to the macro documentation):
prepare!
Flexibility
You can use any other magical token macro like paste to add functionality:
sandwich!
// Will generate:
// const BREAD_U32: u32 = 100;
// const BREAD_F32: f32 = 12.9;