count

Function count 

Source
pub fn count<T, F>(data: &[T], predicate: F) -> usize
where F: Fn(&T) -> bool,
Expand description

Returns the count of values in the slice that satisfy the predicate.

ยงExample

use d3rs::array::count;

let data = vec![1, 2, 3, 4, 5, 6];
assert_eq!(count(&data, |x| x % 2 == 0), 3);