Expose specialized versions of AHasher through specialized-hashers feature#156
Open
fu5ha wants to merge 1 commit intotkaitchuck:masterfrom
Open
Expose specialized versions of AHasher through specialized-hashers feature#156fu5ha wants to merge 1 commit intotkaitchuck:masterfrom
AHasher through specialized-hashers feature#156fu5ha wants to merge 1 commit intotkaitchuck:masterfrom
Conversation
tkaitchuck
reviewed
May 24, 2023
| #[cfg(feature = "specialize")] | ||
| pub(crate) struct AHasherFixed(pub AHasher); | ||
|
|
||
| /// A specialized hasher for fixed size primitives larger than 64 bits. |
Owner
There was a problem hiding this comment.
This doesn't have to be strictly primitives, just fixed in size. So for example a (u128, u128) would be ok with this. It just hasn't been used that way now as I don't have a way to detect such arbitrary structures.
|
|
||
| #[cfg(feature = "specialize")] | ||
| pub(crate) struct AHasherU64 { | ||
| /// A specialized hasher for only primitives <= 64 bits. |
Owner
There was a problem hiding this comment.
If these are public, they should have a bit more docs. It is probably worth enumerating the types that this works with. (Notably usize is not one, as it can technically be 128 bits on some exotic systems)
|
|
||
| #[cfg(feature = "specialize")] | ||
| pub(crate) struct AHasherStr(pub AHasher); | ||
| /// A specialized hasher for strings. |
Owner
There was a problem hiding this comment.
This works for anything that can deref / cast to a [u8] so, String, str, slices of primitives etc.
Author
|
Those all make sense to me! It will probably be a few weeks until I get around to it -- going on vacation soon :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
specialized-hashersfeature which exposes the existing specialized hasher implementations that were under the nightly-only specialization feature for manual use. To support this, also addsBuildAHasherU64,BuildAHasherFixed, andBuildAHasherStrtypes that can be used in places that expectBuildHashers and which leverage existing infrastructure to create these specialized versions of hashers.