indexmap

A hash table for Rust that preserves insertion order and supports lookup by index

Library
Cargo
v2.14.2
2,449 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
64 /100 Good
Development Activity 60
Maintenance 40
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 82
Code Quality 85
Innovation 75
Learning Curve 70

indexmap is a pure-Rust hash table implementation that keeps entries in insertion order while still offering hash-map-speed lookups by key, and additionally lets you look up entries by their numerical position. Internally it pairs a raw hash table of key-value indices with a dense vector of the actual key-value pairs, built on hashbrown (the same table implementation backing Rust’s standard HashMap).

Because iteration runs over the dense, contiguous vector rather than scattered hash-table slots, indexmap is both fast to iterate and predictable to serialize or diff — a property plain HashMap doesn’t offer. It’s one of the most widely depended-upon crates in the Rust ecosystem (over a billion downloads), used anywhere insertion order matters: config/serialization crates, rustc itself, and general application code that wants map semantics without giving up ordering guarantees.

What You Get

  • IndexMap<K, V> and IndexSet<T> types with familiar map/set APIs plus indexed access (.get_index(), .get_index_of())
  • Insertion-order iteration that stays stable unless you call an order-changing removal method
  • A choice between .swap_remove() (fast, breaks order) and .shift_remove() (preserves relative order, O(n))
  • Optional integrations via feature flags: serde, rayon (parallel iterators), arbitrary, quickcheck, borsh, and sval
  • no_std support for embedded/constrained environments

Common Use Cases

  • Configuration or manifest data structures where output order should match the order keys were declared
  • Deduplicating a sequence while retaining first-seen order, using IndexSet
  • Data pipelines that need both fast key lookup and stable positional/index access into the same collection
  • Compiler and tooling internals (e.g. rustc) where deterministic iteration order matters for reproducible output

Under The Hood

Architecture The crate’s core lives in src/map.rs (~1,890 lines) and src/set.rs (~1,480 lines), each wrapping a shared inner structure (src/inner.rs) that pairs a raw hash table of key-value indices with a dense Vec of the actual entries — lookups hash the key to find its index, then index straight into the vector, giving both hash-map-speed access and vector-speed iteration. src/lib.rs (284 lines) wires up feature-gated modules for serde, rayon, arbitrary, borsh, and sval integrations. Tech Stack Built directly on hashbrown for the underlying SIMD-accelerated table (the same crate Rust’s std HashMap uses), with equivalent for flexible key-borrowing lookups; all other integrations (serde, rayon, quickcheck, borsh, sval) are optional via Cargo feature flags, keeping the default dependency footprint minimal. Code Quality The crate carries a substantial tests/ suite (tests.rs, quick.rs for property-based testing via quickcheck, plus equivalent_trait.rs) alongside separate test-nostd and test-serde sub-crates that validate feature combinations in isolation — a level of cross-feature test isolation uncommon in most libraries. API Design The public API deliberately mirrors std::collections::HashMap/HashSet method-for-method so it’s usable as a near drop-in replacement, while layering on indexed-access methods (get_index, get_index_of) and an explicit choice between swap_remove (fast, reorders) and shift_remove (preserves order) so callers make an informed trade-off rather than being surprised by reordering.

Used by 17 apps in this directory

Rust
76%
GPL 3.0

Pipedash

Developer Tools · Devops · Monitoring

1,103

One dashboard to monitor, trigger, and cancel CI/CD pipelines across GitHub, GitLab, Jenkins, Tekton, Buildkite, ArgoCD, and Bitbucket — desktop, Docker, or iOS.

View details
80
Repo Health
64
Technical
73
Dependency
Built with
Rust 76%
TypeScript 24%
Updated 5 days ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,823

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 5 days ago
Rust
97%
MPL 2.0

Sonic

Databases · Search

21,366

Fast, lightweight, schema-less search backend in Rust — microsecond queries, 30MB RAM, no document storage required.

View details
88
Repo Health
88
Technical
70
Dependency
Built with
Rust 97%
Updated 1 weeks ago
Rust
98%

Stalwart

Collaboration

15,268

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
88
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 1 weeks ago
Rust
46%
MIT

Svix

Automation · Developer Tools

3,463

Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
Rust 46%
C# 16%
Updated 6 days ago
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,708

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
68
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 4 months ago
Rust
97%
Apache 2.0

Volga

Data Engineering

161

A Rust-based real-time data processing engine for AI/ML feature computation, built on Apache DataFusion and Arrow — positioned as an alternative to Flink, Spark, Chronon, and OpenMLDB with unified streaming, batch, and request-time execution.

View details
61
Repo Health
67
Technical
72
Dependency
Built with
Rust 97%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers