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
.map(), .filter(), but no .each()
13
6310
January 12, 2023
Difference on Iterator predicate bounds
2
673
January 12, 2023
Some C# LINQ Samples to Rust
3
4226
January 12, 2023
2 filters vs 1 filter versions - Need to confirm if the 2 filter version still runs with single loop when fold comes into action
help
4
681
December 4, 2019
How to collect... nothing?
help
14
7829
January 12, 2023