billyrieger / bimap-rs

Generic bijective maps in Rust
Apache License 2.0
129 stars 26 forks source link

Add a value to BiHashMap #36

Open alexkazik opened 2 years ago

alexkazik commented 2 years ago

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:

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.