Expand description
This crate contains several bi-directional map types that help pair items between two sets.
Unlike a traditional hashmap, every item in any cycle map can be used as a key to access its
companion item(s). They do this while keeping a single copy of each item and while maintaining
lookup speeds on par with those of a standard hash map. This crate is build on top of the
hashbrown
implementation of a hash table to provide effiecent storage and lookups.
Items are stored with the hashes of either companion item. This hash, along with an id, is used to uniquely lookup items between sets. That is, given some item in the left set, its companion item can always be found and used to find the given left item (and visa versa).
This crate contains three different maps. There are two kinds of maps for mapping pairs of items
(i.e. one-to-one). One map, CycleMap
, forces every item to be paired. The other,
PartialCycleMap
allows for items to be unpaired. The last map, GroupMap
,
allow multiple (left) item to be paired with one right item.
CycleMap is build on top of hashbrown
. All maps use its default hashing algorithm, but
different hashing algorithms can be specified on creation of any map.
Re-exports
pub use crate::cycle_map::CycleMap;
pub use crate::partial_cycle_map::PartialCycleMap;
pub use crate::group_map::GroupMap;
pub use crate::optionals::*;
Modules
- A strict one-to-one map
- A strick many-to-one map
- Enums similar to Option
- A weak one-to-one map