Guest User

Untitled

a guest
Nov 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. impl of iter::base_iter<uint> for uint
  2. {
  3. fn each(blk: fn(&&uint) -> bool)
  4. {
  5. let mut i = 0u;
  6. while i < self
  7. {
  8. if (!blk(i))
  9. {
  10. ret;
  11. }
  12. i += 1u;
  13. }
  14. }
  15.  
  16. fn size_hint() -> option<uint>
  17. {
  18. option::some(self)
  19. }
  20. }
  21.  
  22. let names = iter::map_to_vec(N) {|i: uint| #fmt["a%?", i]};
Add Comment
Please, Sign In to add comment