duplicate
Attribute macro for code duplication with substitution.
Motivation
If you find yourself in need of copying a block of code and then making some small changes to fit the new use case, this crate is for you.
The duplicate
attribute macro will duplicate an item any number of times while inserting custom code in the designated places in each duplicate.
For an in-depth explanation of the syntax and features, see the documentation.
Example
use duplicate;
/// Trait we want to implement for u8, u16, and u32
assert!;
assert!;
assert!;
Expands to:
use duplicate;
/// Trait we want to implement for u8, u16, and u32
assert!;
assert!;
assert!;
Changelog
Added
- Crate readme now includes list of changes when published to
crates.io
.