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

Add a value to BiHashMap #36

Open
alexkazik opened this issue Jul 13, 2022 · 0 comments
Open

Add a value to BiHashMap #36

alexkazik opened this issue Jul 13, 2022 · 0 comments

Comments

@alexkazik
Copy link

I've created a version which is able to store a value (in addition to the two keys):
https://github.com/alexkazik/bimap-rs/tree/set-and-map

This approach renames BiHashMap to BiHashSet (since it contains no value) and adds a BiHashMap (sorry for the confusion).

The map has functions like:

  • get_value_by_left()
  • get_mut_value_by_left()
  • get_key_value_by_left()
  • iter_mut()
    And all insert and similar functions are now accept a value in addition to the keys.

As a followup commit the set instance is based on the map (with value ()), like HashSet.

All existing tests, and the doc-tests for map are working (no full test-suite for map).

I don't know if basing Set on Map will have any performance or other issues.

Unfortunately I won't be using it in my project so I don't know if I'll continue working on this approach.

Feel free to use as much as you want.

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

No branches or pull requests

1 participant