Skip to content

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

Description

@biryukovmaxim

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions