Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Countable<T>{
- fn count_predicate(self, predicate : fn(&T) -> bool) -> usize;
- }
- impl<I : Iterator> Countable<I::Item> for I {
- fn count_predicate(self, predicate: fn(&I::Item) -> bool) -> usize{
- self.filter(predicate).count()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement