(&mut self)
| 38 | type Item = io::Result<Rc<String>>; |
| 39 | |
| 40 | fn next(&mut self) -> Option<Self::Item> { |
| 41 | let buf = match Rc::get_mut(&mut self.buf) { |
| 42 | Some(buf) => { |
| 43 | buf.clear(); |
| 44 | buf |
| 45 | } |
| 46 | None => { |
| 47 | self.buf = new_buf(); |
| 48 | Rc::make_mut(&mut self.buf) |
| 49 | } |
| 50 | }; |
| 51 | |
| 52 | self.reader |
| 53 | .read_line(buf) |
| 54 | .map(|u| { |
| 55 | if u == 0 { |
| 56 | None |
| 57 | } else { |
| 58 | Some(Rc::clone(&self.buf)) |
| 59 | } |
| 60 | }) |
| 61 | .transpose() |
| 62 | } |
| 63 | } |
| 64 | } |
no test coverage detected