ihciah / ihciah/small-map

Feature Request: Add a generic parameter for choosing fallback map type

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
109
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I'd like to propose a backward-compatible enhancement that would make the crate more flexible without changing its default behavior.

Feature Request

Add a generic type parameter that allows choosing the fallback map type used when the inline capacity is exceeded.

Today, when the number of elements grows beyond N, SmallMap falls back to a fixed HashMap. This works well for many cases, but some applications would benefit from selecting a different map backend.

Motivation

Different workloads have different needs once maps exceed the inline capacity:

Faster full-map iteration
Some backends (such as IndexMap) have more cache-efficient iteration over medium-sized maps, especially when scanning all entries frequently.

Inline behavior remains unchanged.
Existing users see no behavior changes.

If this sounds reasonable, I’d be happy to attempt a draft PR.

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

Start by locating the SmallMap implementation and the code that switches to the fixed HashMap after inline capacity is exceeded. Review the crate's existing tests and API usage before assessing the generic design; done means callers can choose a fallback map type while existing defaults and inline behavior remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.