-
Notifications
You must be signed in to change notification settings - Fork 161
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
Make with_hasher const #203
Conversation
src/map.rs
Outdated
@@ -179,8 +176,11 @@ impl<K, V, S> IndexMap<K, V, S> { | |||
} | |||
|
|||
/// Create a new map with `hash_builder` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note about the const
ness, and that (like new
) it does not allocate?
(ditto on the set)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also noted ahash
in particular because not many hash builders are const-able.
src/map.rs
Outdated
/// If you need `hash_builder` that can be made in the static context, | ||
/// consider [`ahash`](https://docs.rs/ahash/0.7.4/ahash/struct.RandomState.html#method.with_seeds). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's nice to help the user but I'd like to avoid having such versioned urls - they are stale quickly - and fast-changing information - here. I would suggest we skip mentioning Ahash. The PR description is a good place for this info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, looks good to me
Closes #202
If you need
hash_builder
that can be made in the static context, considerahash
.