bimap-rs icon indicating copy to clipboard operation
bimap-rs copied to clipboard

Add a value to BiHashMap

Open alexkazik opened this issue 3 years ago • 0 comments

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.

alexkazik avatar Jul 13 '22 15:07 alexkazik