Skip to content

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

Closed
@steveklabnik

Description

@steveklabnik

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.

Metadata

Metadata

Labels

A-collectionsArea: `std::collections`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions