Open
Conversation
Author
|
Oh, and obviously |
Owner
|
Tuple order is good, I think a name involving |
Also let rustfmt sort the dashmap imports 😬
This is a horrendous stability guarantee, as the string slice storage is now guaranteed. Also, it should probably be called something else.
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.
Adds
get_or_intern_yes,try_get_or_intern_yes,get_or_intern_static_yes,try_get_or_intern_static_yesmethods that return an additional boolean that answers questions like: "Was this a new, never before seen string?", "Am I the first person to receive this key?", "Should I go compile a Regex or other string derivative and store it in a keyed-alike collection eagerly?", etc.This allows doing additional things on the first time a string is seen, without hashing twice.
I updated the doctests to actually test the correctness of the bool returned, but didn't otherwise add tests.
I didn't touch the
Internertrait because it's not sealed and adding the new methods to it would be a breaking change.(An honest default implementation would hash twice by calling
Resolver::contains_key, not sure if that is something we'd want to publish.)