I believe we intend to eventually extend the index traits with the ability to override the x[y] = z syntax specifically using a trait like IndexSet. This would allow hashmaps to be used like map[key] = value and have that insert the key, unlike today where map[key] = value will panic if key is not already present.
To pave the way, the simplest thing is to remove the IndexMut operator from those collections where we would anticipate growing on demand.
I believe that would be btree, hash_map, and possible vec_deque and vec_map.
Thoughts?
cc @aturon @alexcrichton @gankro
I believe we intend to eventually extend the index traits with the ability to override the
x[y] = zsyntax specifically using a trait likeIndexSet. This would allow hashmaps to be used likemap[key] = valueand have that insert the key, unlike today wheremap[key] = valuewill panic ifkeyis not already present.To pave the way, the simplest thing is to remove the
IndexMutoperator from those collections where we would anticipate growing on demand.I believe that would be
btree,hash_map, and possiblevec_dequeandvec_map.Thoughts?
cc @aturon @alexcrichton @gankro