This is an automated archive made by the Lemmit Bot.

The original was posted on /r/rust by /u/Emoun1 on 2024-09-17 14:42:14+00:00.


I’d like to announce version 2.0.0 of the duplicate crate.

About: duplicate provides macros that allow you to avoid repetition. Instead of copy-pasting some Rust code and then editing a few places, duplicate can make copies for you and insert different code in the key places for every copy. See the documentation for more details.

The major feature of this release is the addition of substitute! and substitute_item, which only do global substitutions and no duplication. This was previously possible with duplicate! and duplicate_item by omitting any substitution groups. However, to make the intent of the writer more clear (that no duplication is intended), these macros must now be used. duplicate! and duplicate_item no longer allow using only global substitutions. While this is technically a breaking change, the vast majority of code should still work as before. In the cases that don’t, simply substitute duplicate for substitute.

Since this feature required a breaking change, some other cleanup was done at the same time. The MSRV is increased to 1.65 and the crate itself has now incremented the edition to 2021, among other behind-the-scenes changes.

Got a question, a feature request, or got a weird error message? Feel free to either drop a comment or open an issue. The changes to this crate are mostly a result of feedback from users (which is much appreciated.)