Skip to content
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

Merged
merged 3 commits into from
Jan 6, 2022
Merged

Make with_hasher const #203

merged 3 commits into from
Jan 6, 2022

Conversation

mwillsey
Copy link
Contributor

@mwillsey mwillsey commented Sep 16, 2021

Closes #202

If you need hash_builder that can be made in the static context, consider ahash.

src/map.rs Outdated
@@ -179,8 +176,11 @@ impl<K, V, S> IndexMap<K, V, S> {
}

/// Create a new map with `hash_builder`
Copy link
Member

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 constness, and that (like new) it does not allocate?
(ditto on the set)

Copy link
Contributor Author

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
Comment on lines 182 to 183
/// 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).
Copy link
Member

@bluss bluss Sep 18, 2021

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Member

@bluss bluss left a 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

@cuviper cuviper merged commit f9a3ca9 into indexmap-rs:master Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create indexmap/set in static contexts
3 participants