Is there a shorthand for counting items in an iterator that satisfy a predicate?

I think input.iter().filter(predicate).count() will work.

8 Likes