heapless
heapless copied to clipboard
Add usize index methods to IndexMap
For my usecase, I need to be able to refer to IndexMap keys by usize index as well as by their keys. Specifically, I would like access to the .insert_full(k, v) method and the Index<usize> trait implemented, from the upstream non-heapless IndexMap. Otherwise I'm better off using a plain Vec and doing linear searches, so that I can use both keys and fast usize indexing.
One alternative to the above would be Entry's .index() and IndexMap's .get_index(i) methods, which would also allow me to save the index of a key when I insert it, then read from it later.
Hi, if you can port the upstream methods in to heapless I think this should be fine.