You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make API less surprising by unifying new and with_key? #146
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?
Activity