Trait count_where::CountWhere[][src]

pub trait CountWhere: Iterator {
    fn count_where<P: FnMut(&Self::Item) -> bool>(self, predicate: P) -> usize;
}
Expand description

trait extension that adds count_where functionality to iterators.

Required methods

Implementors

count elements matching given predicate.

Example

let numbers = [5, 5, 5, 2, 1]; assert_eq!(3, numbers.iter().count_where(|n| **n == 5));