Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing claim about HashMap in no_std #274

Open
justinmoon opened this issue Dec 2, 2020 · 4 comments
Open

Confusing claim about HashMap in no_std #274

justinmoon opened this issue Dec 2, 2020 · 4 comments

Comments

@justinmoon
Copy link

This section claims the existence of a collections crate which can provide Vec and HashMap implementations.

I don't believe such a crate exists. Nothing comes up in crates.io. Vec is provided by alloc crate, but HashMap is not.

bors bot added a commit that referenced this issue Nov 8, 2022
333: Remove incorrect claim HashMap is avail in no_std r=adamgreig a=cameronelliott

This should fix and clear up #274, which has driven me crazy a few times.


Co-authored-by: Cameron Elliott <868689+cameronelliott@users.noreply.github.com>
@cameronelliott
Copy link
Contributor

It is worth noting this page says the reason HM is not available is due to a lack of a secure random number generator:
https://stackoverflow.com/a/65470850/86375

@therealprof
Copy link
Contributor

That statement is not quite right. There's no collections crate but a collections module in alloc (re-exported in std). The fact that HashMap (and HashSet) are only available in std rather than alloc due to an implicit requirement of a random generator is annoying but maybe it would be better to simply refer to hashbrown for now instead of highlighting an internal detail which is really no help for a user desperately longing for HashMap?

@cameronelliott
Copy link
Contributor

@therealprof did you by chance look at the PR I submitted? Maybe you have some suggestions or improvement ideas for another PR? It actually sounds like a good idea to mention Hashbrown in that section of the docs.

@therealprof
Copy link
Contributor

I did have a look. I would recommend making two more changes:

  • Change "collections crate" into e.g. "alloc::collections module"
  • Turn the "** HashMap and HashSet are not available due to a lack of a secure random number generator." remrk into a regular text, recommending to look into hashbrown if a HashMap or HashSet collection type is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants