Rust 1.99 (2024 edition) reference · 3 entries

Rust Iterators

Transform, filter, reduce and collect iterators: map, filter_map, sum, fold, max_by_key and collect.

NameDescriptionSince
Iterator::map, filter and filter_map Transform and select items lazily: map each item, keep matching ones, or do both at once with filter_map.
Iterator::sum, fold, any and max_by_key Reduce an iterator to one value: totals, counts, custom folds, checks, and minimum or maximum items.
Iterator::collect Turn an iterator into a collection: Vec, String, HashMap, HashSet, or a Result that fails on the first error.

Was this page helpful?