Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::iter::Iterator;
- trait LineIter<'a> {
- type Iter: Iterator<Item = &'a mut String>;
- fn line_iter(&mut self) -> Self::Iter;
- }
- struct Page<'a> {
- lines: &'a mut Vec<String>,
- }
- impl<'a, 'b> LineIter<'a> for Page<'b>
- where
- 'a: 'b,
- {
- type Iter = std::slice::IterMut<'a, String>;
- fn line_iter(&mut self) -> Self::Iter {
- self.lines.iter_mut()
- }
- }
- fn main() {
- }
Add Comment
Please, Sign In to add comment