Closed
Description
The current Index
isn't great because you have to use &self
and return &T
or T
(via clone) for a map/vector type.
I think it would be best to split it into Index
(with &self
), IndexMut
(with &mut self
) and IndexAssign
(&mut self
, inserting a value).
I'm unsure about the syntax. It would be nice to make it uniform with vector syntax and have &a["foo"]
call Index
for &T
, etc.