You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for building and running duplicate in no_std environments
Motivation:
The library itself is great, it is however a pity it doesn't support no_std targets. While the majority of Rust code that is written depends on the standard library one way or another, I don't see a reason why this one, with its simple design and purpose, shouldn't have support for no_std environments.
Design
Replace all stduse statements with core and alloc ones and any use of HashMaps and HashSets with ones from the hashbrown crate.
Misc:
Since either case we need to depend on Rust's alloc library, perhaps that should be mentioned?
What is the purpose of this change? duplicate is a compile-time only crate, so the fact that it uses std should not limit its use for code that is used in a no_std environments. If I'm misunderstanding, please give me an example use case where this is an issue (especially if its an issue for you).
That... seems to be right? I had been using another crate prior to duplicate and that one for whatever reason refused to compile in a no_std environment, so when I found duplicate I didn't even check if that was the case here.
Activity
Emoun commentedon Jun 22, 2026
Thank you for the interest in this crate.
What is the purpose of this change?
duplicateis a compile-time only crate, so the fact that it usesstdshould not limit its use for code that is used in ano_stdenvironments. If I'm misunderstanding, please give me an example use case where this is an issue (especially if its an issue for you).Oakchris1955 commentedon Jun 22, 2026
That... seems to be right? I had been using another crate prior to
duplicateand that one for whatever reason refused to compile in ano_stdenvironment, so when I foundduplicateI didn't even check if that was the case here.