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
66%
Apache 2.0

agentgateway

AI Development · Developer Tools · Mcp

5,533

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
88
Repo Health
82
Technical
69
Dependency
Built with
Rust 66%
Go 23%
Updated yesterday
Dart
74%
AGPL 3.0

AppFlowy

AI Assistants · Collaboration · Productivity

77,694

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart 74%
Rust 24%
Updated 3 days ago
Rust
37%
Other

Hook0

Devops

1,504

Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.

View details
84
Repo Health
82
Technical
69
Dependency
Built with
Rust 37%
TypeScript 12%
Updated yesterday
Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,779

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
80
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated yesterday
TypeScript
77%
Other

Joplin

Note Taking

56,853

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated yesterday
TypeScript
63%
Apache 2.0

Laminar

AI Development · Monitoring

3,434

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
86
Repo Health
76
Technical
65
Dependency
Built with
TypeScript 63%
Rust 35%
Updated today
Rust
100%
Other

Meilisearch

Search

59,644

Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.

View details
90
Repo Health
88
Technical
67
Dependency
Built with
Rust 100%
Updated yesterday
Rust
71%
MIT

monty

AI Development · Developer Tools

8,763

Run LLM-generated Python code safely inside your agent—no containers, no CPython, no compromise—with sub-microsecond startup.

View details
88
Repo Health
83
Technical
73
Dependency
Built with
Rust 71%
Python 24%
Updated yesterday
Rust
93%
Apache 2.0

Murr

Databases

117

A RocksDB-based NVMe/S3 cache purpose-built for AI inference workloads — a faster Redis replacement optimized for batch, low-latency, zero-copy reads and writes between data pipelines and inference apps.

View details
73
Repo Health
72
Technical
75
Dependency
Built with
Rust 93%
Updated 5 days 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