Skip to main content

parse_rustdoc_sections

Function parse_rustdoc_sections 

Source
pub fn parse_rustdoc_sections(doc: &str) -> RustdocSections
Expand description

Parse a rustdoc string into RustdocSections.

Recognises level-1 ATX headings whose name matches one of the standard rustdoc section names (Arguments, Returns, Errors, Panics, Safety, Example, Examples). Anything before the first heading becomes summary. Unrecognised headings are folded into the preceding section verbatim, so unconventional rustdoc isn’t lost.

The input is expected to already have rustdoc-hidden lines stripped and intra-doc-link syntax rewritten by [crate::extractor::helpers::normalize_rustdoc].