Adds the given line to this printer. Depending on what's in the line, this may or may not print the line immediately to the underlying buffer. If the line starts or is part of an existing code snippet, then the lines will get buffered until the code snippet is complete.
(&mut self, line: InputDocstringLine<'src>)
| 294 | /// of an existing code snippet, then the lines will get buffered until |
| 295 | /// the code snippet is complete. |
| 296 | fn add_one(&mut self, line: InputDocstringLine<'src>) -> FormatResult<()> { |
| 297 | // Just pass through the line as-is without looking for a code snippet |
| 298 | // when docstring code formatting is disabled. And also when we are |
| 299 | // formatting a code snippet so as to avoid arbitrarily nested code |
| 300 | // snippet formatting. We avoid this because it's likely quite tricky |
| 301 | // to get right 100% of the time, although perhaps not impossible. It's |
| 302 | // not clear that it's worth the effort to support. |
| 303 | if !self.f.options().docstring_code().is_enabled() || self.f.context().docstring().is_some() |
| 304 | { |
| 305 | return self.print_one(&line.as_output()); |
| 306 | } |
| 307 | self.code_example.add(line, &mut self.action_queue); |
| 308 | self.run_action_queue() |
| 309 | } |
| 310 | |
| 311 | /// Process any actions in this printer's queue until the queue is empty. |
| 312 | fn run_action_queue(&mut self) -> FormatResult<()> { |
no test coverage detected