Last active
August 29, 2015 14:01
-
-
Save krdln/52db0de9b427b2161546 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Iterator<T> { | |
//... | |
fn len(self) { // not &mut self ! | |
match self.size_hint() { | |
(bot, Some(up)) if bot == up => bot, | |
_ => self.fold(0, |cnt, _x| cnt + 1) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment