itertools

Extra iterator adaptors, methods, and macros extending Rust's standard Iterator trait

Library
Cargo
v0.15.0
3,178 stars
Apache License 2.0

Repository Health

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

Technical Analysis

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

itertools extends Rust’s standard Iterator trait with dozens of additional adaptors, free functions, and macros that the standard library deliberately leaves out — grouping, chunking, Cartesian products, deduplication, multi-way merging, permutations, and more. It’s implemented almost entirely as an extension trait (Itertools) that’s automatically available on any existing iterator once imported, so it composes with std’s own adaptors rather than replacing them.

As one of the most-downloaded crates in the Rust ecosystem (over a billion downloads), it functions as an unofficial-but-standard extension to std::iter, filling gaps that show up constantly in real code — the kind of iterator operations found in Python’s itertools module or functional-language standard libraries but historically absent from Rust’s core.

What You Get

  • The Itertools extension trait adding 100+ methods to any existing Iterator implementation
  • Grouping and chunking adaptors (.group_by(), .chunks(), .tuples()) for structuring sequential data
  • Combinatorial adaptors (.permutations(), .combinations(), .cartesian_product(), .powerset())
  • Deduplication and set-like operations (.unique(), .unique_by(), .duplicates())
  • Macros like izip! and chain! for ergonomic multi-iterator zipping and chaining

Common Use Cases

  • Deduplicating or sorting a stream of values inline within an iterator chain instead of collecting into an intermediate Vec first
  • Generating combinations, permutations, or Cartesian products for combinatorial or test-data-generation code
  • Grouping consecutive elements by a key (.group_by()) when processing sorted or structured sequential data
  • Zipping more than two iterators together ergonomically via the izip! macro instead of nested .zip() calls

Under The Hood

Architecture Roughly 15,600 lines are organized as one implementation file per adaptor or family of related methods (combinations.rs, groupbylazy.rs, intersperse.rs, duplicates_impl.rs, etc.) under src/, with src/adaptors/ holding the lower-level lazy-iterator plumbing each adaptor is built from, and lib.rs assembling everything into the single public Itertools trait — a structure that mirrors the standard library’s own core::iter module organization for familiarity. Tech Stack The crate has effectively zero required dependencies beyond std (with either as an optional lightweight dependency for a couple of adaptors), which matters given how deep in the dependency graph it sits — over a billion downloads means minimizing its own footprint has outsized ecosystem impact. Code Quality tests/ includes a dedicated laziness.rs suite verifying that adaptors don’t eagerly evaluate more of the underlying iterator than necessary (a correctness property specific to iterator libraries), plus specializations.rs testing that performance-optimization overrides (like size_hint) stay behaviorally consistent with the default implementations. API Design Nearly every addition is a method on the Itertools trait rather than a free function, so it chains directly into existing .iter().map().filter() pipelines with one import — deliberately matching std::iter’s own method-chaining idiom rather than introducing a different mental model for the 100+ additional operations it provides.

Used by 18 apps in this directory

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 6 days ago
Java
93%
Apache 2.0

QuestDB

Analytics · Databases

17,466

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
67
Dependency
Built with
Java 93%
Updated 6 days ago
Rust
89%
Apache 2.0

Quickwit

Monitoring · Search

11,736

Cloud-native search engine for logs and traces, delivering sub-second search directly on S3, GCS, or Azure Blob storage at a fraction of Elasticsearch's cost.

View details
88
Repo Health
83
Technical
70
Dependency
Built with
Rust 89%
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 1 weeks ago
C
74%
AGPL 3.0

TDengine

Databases

25,168

A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.

View details
97
Repo Health
71
Technical
65
Dependency
Built with
C 74%
C++ 19%
Updated 1 weeks 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
71%
MIT

Trieve

AI Development · Developer Tools · Search

2,721

All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.

View details
42
Repo Health
74
Technical
65
Dependency
Built with
Rust 71%
Updated 9 months ago
Python
66%
Apache 2.0

WrenAI

AI Agents · Analytics · Data Engineering

17,958

Open-source GenBI engine that lets AI agents turn natural-language questions into governed SQL, charts, and shareable dashboards across 20+ data sources — no vendor lock-in, no black-box prompts.

View details
91
Repo Health
91
Technical
68
Dependency
Built with
Python 66%
Rust 31%
Updated 1 weeks 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