Are all iterators lazy?

⚓ Rust    📅 2026-03-08    👤 surdeus    👁️ 4      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Are all iterators lazy?

From the documentation of BTreeSet:

Difference
A lazy iterator producing elements in the difference of BTreeSets.
ExtractIf
An iterator produced by calling extract_if on BTreeSet.
Intersection
A lazy iterator producing elements in the intersection of BTreeSets.
IntoIter
An owning iterator over the items of a BTreeSet in ascending order.
Iter
An iterator over the items of a BTreeSet.
Range
An iterator over a sub-range of items in a BTreeSet.
SymmetricDifference
A lazy iterator producing elements in the symmetric difference of BTreeSets.
Union
A lazy iterator producing elements in the union of BTreeSets.

Why “lazy” ? Isn’t it the case that all Rust iterators are “lazy”? Is there some subtle distinction I am missing here?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed