rust-embedded / rust-embedded/heapless

Add usize index methods to IndexMap

Open
#325 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
2k
Forks
253
Avg merge
1d 2h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare heapless IndexMap with the upstream non-heapless IndexMap, starting from the requested insert_full, Index<usize>, Entry::index(), and get_index() APIs. Done means the requested usize-based access methods are available with behavior consistent with the upstream implementation; the issue does not name specific files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.