Improve std::hash::Hasher to finish with an associated type #65744
Labels
rust-2-breakage-wishlist
In the wishlist of breaking changes that requires rust 2.0
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
std::hash::Hasher
currently defines afinish()
method that returns a fixed type (u64
). This trait could be improved by changing the return type to some associatedOutput
type. I don't see a particular reason this wouldn't work, since, for instance,std::collections::HashMap
can simply provide aHasher
which produces the type it expects. This would be nice as then types implementingstd::hash::Hash
could be used with, for example, cryptographic hash functions. I am aware of thedigest
crate intended for that use case, but I don't see a reason not to improve the existing trait.The text was updated successfully, but these errors were encountered: