-
Notifications
You must be signed in to change notification settings - Fork 276
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
Add low-level HashTable
API
#466
Merged
Merged
Commits on Oct 18, 2023
-
The primary use case for this type over [`HashMap`] or [`HashSet`] is to support types that do not implement the [`Hash`] and [`Eq`] traits, but instead require additional data not contained in the key itself to compute a hash and compare two elements for equality. `HashTable` has some similarities with `RawTable`, but has a completely safe API. It is intended as a replacement for the existing raw entry API, with the intend of deprecating the latter and eventually removing it. Examples of when this can be useful include: - An `IndexMap` implementation where indices into a `Vec` are stored as elements in a `HashTable<usize>`. Hashing and comparing the elements requires indexing the associated `Vec` to get the actual value referred to by the index. - Avoiding re-computing a hash when it is already known. - Mutating the key of an element in a way that doesn't affect its hash. To achieve this, `HashTable` methods that search for an element in the table require a hash value and equality function to be explicitly passed in as arguments. The method will then iterate over the elements with the given hash and call the equality function on each of them, until a match is found.
Configuration menu - View commit details
-
Copy full SHA for f625528 - Browse repository at this point
Copy the full SHA f625528View commit details -
Configuration menu - View commit details
-
Copy full SHA for a2b8f18 - Browse repository at this point
Copy the full SHA a2b8f18View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b8426e - Browse repository at this point
Copy the full SHA 3b8426eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 06ba464 - Browse repository at this point
Copy the full SHA 06ba464View commit details -
Co-authored-by: Josh Stone <cuviper@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for cce9925 - Browse repository at this point
Copy the full SHA cce9925View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05bee57 - Browse repository at this point
Copy the full SHA 05bee57View commit details -
Configuration menu - View commit details
-
Copy full SHA for 878b5bf - Browse repository at this point
Copy the full SHA 878b5bfView commit details
Commits on Oct 19, 2023
-
Configuration menu - View commit details
-
Copy full SHA for cbbb823 - Browse repository at this point
Copy the full SHA cbbb823View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9556bf4 - Browse repository at this point
Copy the full SHA 9556bf4View commit details
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.