The Rust Programming Language Forum
Is there a shorthand for counting items in an iterator that satisfy a predicate?
help
bjorn3
December 19, 2020, 5:04pm
2
I think
input.iter().filter(predicate).count()
will work.
8 Likes
show post in topic
Related topics
Topic
Replies
Views
Activity
Rust iterators and looking forward (peek/multipeek)
help
15
6841
January 12, 2023
Find element to the left/right of given predicate
2
603
May 21, 2020
Accept an Iterator which can be count without consuming itself
help
7
2662
December 28, 2022
How to count multiple filters of same iterator?
help
11
332
August 16, 2024
Best way to compose iterator operations
4
866
January 12, 2023