Print all of the lines in the given iterator to this printer's formatter. Note that callers may treat the first line specially, such that the iterator given contains all lines except for the first.
(
&mut self,
mut lines: std::iter::Peekable<std::str::Split<'src, char>>,
)
| 270 | /// Note that callers may treat the first line specially, such that the |
| 271 | /// iterator given contains all lines except for the first. |
| 272 | fn add_iter( |
| 273 | &mut self, |
| 274 | mut lines: std::iter::Peekable<std::str::Split<'src, char>>, |
| 275 | ) -> FormatResult<()> { |
| 276 | while let Some(line) = lines.next() { |
| 277 | let line = InputDocstringLine { |
| 278 | line, |
| 279 | offset: self.offset, |
| 280 | next: lines.peek().copied(), |
| 281 | }; |
| 282 | // We know that the normalized string has \n line endings. |
| 283 | self.offset += line.line.text_len() + "\n".text_len(); |
| 284 | self.add_one(line)?; |
| 285 | } |
| 286 | self.code_example.finish(&mut self.action_queue); |
| 287 | self.run_action_queue() |
| 288 | } |
| 289 | |
| 290 | /// Adds the given line to this printer. |
| 291 | /// |