Looks for the start of a code example. If one was found, then the given line is kept and added as part of the code example. Otherwise, the line is pushed onto the queue unchanged to be printed as-is. # Panics This panics when the existing code-example is any non-None value. That is, this routine assumes that there is no ongoing code example being collected and looks for the beginning of another
(
&mut self,
original: InputDocstringLine<'src>,
queue: &mut VecDeque<CodeExampleAddAction<'src>>,
)
| 755 | /// is, this routine assumes that there is no ongoing code example being |
| 756 | /// collected and looks for the beginning of another code example. |
| 757 | fn add_start( |
| 758 | &mut self, |
| 759 | original: InputDocstringLine<'src>, |
| 760 | queue: &mut VecDeque<CodeExampleAddAction<'src>>, |
| 761 | ) { |
| 762 | assert!(self.kind.is_none(), "expected no existing code example"); |
| 763 | if let Some(doctest) = CodeExampleDoctest::new(original) { |
| 764 | self.kind = Some(CodeExampleKind::Doctest(doctest)); |
| 765 | queue.push_back(CodeExampleAddAction::Kept); |
| 766 | } else if let Some(litblock) = CodeExampleRst::new(original) { |
| 767 | self.kind = Some(CodeExampleKind::Rst(litblock)); |
| 768 | queue.push_back(CodeExampleAddAction::Print { original }); |
| 769 | } else if let Some(fenced) = CodeExampleMarkdown::new(original) { |
| 770 | self.kind = Some(CodeExampleKind::Markdown(fenced)); |
| 771 | queue.push_back(CodeExampleAddAction::Print { original }); |
| 772 | } else { |
| 773 | queue.push_back(CodeExampleAddAction::Print { original }); |
| 774 | } |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | /// The kind of code example observed in a docstring. |
no outgoing calls
no test coverage detected