Open Ratysz opened 3 years ago
We talked about this with @sdleffler on Discord a little bit. I think this functionality is useful, but I'd like to explore the option of being able to collect from an iterator of (Index, T)
before we decide either way. If that approach has no obvious downsides, it seems preferable to me.
Sounds fine by me; in fact, I would prefer that as well, as it's strictly more versatile. Don't hesitate to close this whenever, should you settle on that approach.
Analogous to
Iterator::map()
, array::map()
, etc...My usecase is pretty much typestate pattern; I want to shed parts of stored items that aren't useful anymore, but I also want existing indices to remain valid.
Alternative approach is to allow constructing
Arena<T>
from iterator of(Index, T)
. This could also help with implementing serialization further down the line.