After #74, it methods converting from an id to an integer (if supported) were lifted to IdType, leaving IntegerIdType just a marker trait. Thanks to that CompactIdMap can now support all id types using the current implementation for integer ids and a "map: id -> usize" (not implemented yet) implementation for the others. The internals of the CompactIdMap should be structured that there are multiple backends (isomorphic, vec, map) and the most appropriate one is picked during CompactIdMap initialization and stored into it as an enum variant. When a method on CompactIdMap is called, it is simply delegated to the method implementation of the backend.
Some notes:
Whether the IdType is integer can be checked by calling I::is_integer().
The "map" backend should use indexmap crate which conveniently (and efficiently) provides usize -> id mapping via get_index method.
Rename virt and real methods to to_virt and to_real, respectively, to avoid ambiguity ("does real mean that I get real or should give real" confusion).
After #74, it methods converting from an id to an integer (if supported) were lifted to
IdType
, leavingIntegerIdType
just a marker trait. Thanks to thatCompactIdMap
can now support all id types using the current implementation for integer ids and a "map: id -> usize" (not implemented yet) implementation for the others. The internals of theCompactIdMap
should be structured that there are multiple backends (isomorphic, vec, map) and the most appropriate one is picked duringCompactIdMap
initialization and stored into it as an enum variant. When a method onCompactIdMap
is called, it is simply delegated to the method implementation of the backend.Some notes:
IdType
is integer can be checked by callingI::is_integer()
.usize -> id
mapping viaget_index
method.virt
andreal
methods toto_virt
andto_real
, respectively, to avoid ambiguity ("doesreal
mean that I get real or should give real" confusion).