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

HashMap's docs can do a better job of explaining how to implement a hasher #71652

Closed
steveklabnik opened this issue Apr 28, 2020 · 0 comments · Fixed by #71677
Closed

HashMap's docs can do a better job of explaining how to implement a hasher #71652

steveklabnik opened this issue Apr 28, 2020 · 0 comments · Fixed by #71677
Assignees
Labels
A-collections Area: `std::collection` A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug.

Comments

@steveklabnik
Copy link
Member

The docs say:

The hashing algorithm can be replaced on a per-HashMap basis using the default, with_hasher, and with_capacity_and_hasher methods. Many alternative algorithms are available on crates.io, such as the fnv crate.

However, there isn't a mention of the Hasher trait. If you look at the docs for with_hasher, the type is just S. If you look at the struct definition, S = RandomState is all you get. You have to click to RandomState, and then see that it implements Hasher, to know what's going on.

@steveklabnik steveklabnik added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. labels Apr 28, 2020
@jonas-schievink jonas-schievink added the A-collections Area: `std::collection` label Apr 28, 2020
@Mark-Simulacrum Mark-Simulacrum self-assigned this Apr 29, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Add explicit references to the BuildHasher trait

Fixes rust-lang#71652
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Add explicit references to the BuildHasher trait

Fixes rust-lang#71652
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Add explicit references to the BuildHasher trait

Fixes rust-lang#71652
@bors bors closed this as completed in 21d58a1 May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: `std::collection` A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants