macro-template
Overview
macro-template is a procedural macro that generates repeated Rust code in multiple places with table-driven sources.
For example, the following code generates From implementations for MyEnum from all its variants:
template!
You can iterate over a matrix as well:
template!
Or, you can generate repeated match arms by pattern:
template!
Naturally, if the match arm differs left-hand side and right-hand side:
template!
The iterator can be a sequence of numbers, characters, or bytes:
// sequential numeric counter
let tuple = ;
let mut sum = 0;
template!
assert_eq!;
// sequential character collector
let mut string = Stringnew;
template!
assert_eq!;
You can combine multiple iterators in a single template:
let mut values = Vecnew;
template!
assert_eq!;
Minimum Rust version policy
This crate's minimum supported rustc version is 1.85.0.
The current policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if crate 1.0 requires Rust 1.85.0, then crate 1.0.z for all values of z will also require Rust 1.85.0 or newer. However, crate 1.y for y > 0 may require a newer minimum version of Rust.
License
This project is licensed under Apache License, Version 2.0.