Guest User

Untitled

a guest
May 20th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. struct IteratorResult<'a,T> where T: 'a {
  2. pub value: Option<&'a T>,
  3. pub done: bool
  4.  
  5. }
  6.  
  7. struct JsIterator<T,Item> where T: Iterator<Item=Item> {
  8. iter: T
  9.  
  10. }
  11.  
  12. impl<T,Item> JsIterator<T,Item> where T: Iterator<Item=Item>
  13. {
  14.  
  15. fn next(&self) -> IteratorResult<Item>
  16. {
  17. match self.iter.next() {
  18. Some(ref v) => IteratorResult { value: Some(&v), done: false },
  19. None => IteratorResult { value: None, done: true }
  20. }
  21. }
  22.  
  23. }
  24. fn main() {
  25. }
Add Comment
Please, Sign In to add comment