Guest User

Untitled

a guest
Jun 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. use std::iter::Iterator;
  2.  
  3. trait LineIter<'a> {
  4. type Iter: Iterator<Item = &'a mut String>;
  5.  
  6. fn line_iter(&mut self) -> Self::Iter;
  7. }
  8.  
  9. struct Page<'a> {
  10. lines: &'a mut Vec<String>,
  11. }
  12.  
  13. impl<'a, 'b> LineIter<'a> for Page<'b>
  14. where
  15. 'a: 'b,
  16. {
  17. type Iter = std::slice::IterMut<'a, String>;
  18.  
  19. fn line_iter(&mut self) -> Self::Iter {
  20. self.lines.iter_mut()
  21. }
  22. }
  23.  
  24. fn main() {
  25.  
  26. }
Add Comment
Please, Sign In to add comment