SHARE
TWEET

Untitled

a guest Oct 16th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trait Countable<T>{
  2.     fn count_predicate(self, predicate : fn(&T) -> bool) -> usize;
  3. }
  4. impl<I : Iterator> Countable<I::Item> for I {
  5.     fn count_predicate(self, predicate: fn(&I::Item) -> bool) -> usize{
  6.         self.filter(predicate).count()
  7.     }
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top