In light of a possible 2.0 version of this crate, would it be possible to unify the constructors new and with_key of SlotMap into a single new constructor?
In my understanding, the convention for with_ constructors is that they take additional parameters (e.g. Vec::with_capacity). But here with_key implies something about the type of the collection. In addition, it is confusing that SlotMap with a key type different from the default does not offer a new default constructor.
One way to resolve both issues would be to make DefaultKey the default for the first generic argument of the SlotMap type. Wouldn’t this result in a less surprising API?
In light of a possible 2.0 version of this crate, would it be possible to unify the constructors
newandwith_keyofSlotMapinto a singlenewconstructor?In my understanding, the convention for
with_constructors is that they take additional parameters (e.g.Vec::with_capacity). But herewith_keyimplies something about the type of the collection. In addition, it is confusing thatSlotMapwith a key type different from the default does not offer anewdefault constructor.One way to resolve both issues would be to make
DefaultKeythe default for the first generic argument of theSlotMaptype. Wouldn’t this result in a less surprising API?