duplicate
duplicate copied to clipboard
Add `substitute` macro(s)
Short Description:
Provide substitute and substitute_item which only provide the global substitution feature of the main macros.
Motivation:
Sometimes, duplicate may be used only to avoid repeating something within the code, but not to duplicate the whole thing.
Providing these macro would make the intent more clear for readers of the code that no duplication is happening.
Design
Misc:
Provide substitute! and substitute_item as synonyms for duplicate! and duplicate_item respectively, where only global substitutions are allowed.
For clarity: Currently this is fully supported by duplicate! and duplicate_item. The new macros would just be a more clear way of showing that we are not actually duplicating anything
Initial implementation done.
Missing work:
- [ ] Update root level documentation.
- [x] Since we are bumping major versions anyway (increased base MSRV), we could change
duplicate!andduplicate_itemto not allow no duplications. - [x] Update changelog
- [ ] Allow nested
substitute!calls, like you can withduplicate!