parsers.rust

Rust regex-based parser. Extracts functions, structs, enums, traits, and impl blocks from Rust source files.

📄 /home/runner/work/autoredocs/autoredocs/src/autoredocs/parsers/rust.py

Classes

class
class RustParser(BaseParser)
Regex-based parser for Rust source files.
📍 Line 78

Methods

def
def parse_file(self, filepath: str | Path) -> ModuleDoc | None
Parse a Rust source file and return a ModuleDoc.
def
def _find_impl_methods(self, source: str, type_name: str, doc_map: dict[int, str]) -> list[FunctionDoc]
Extract methods from impl blocks for the given type.

Functions

def
def _extract_brace_body(source: str, start: int) -> str
Extract text inside braces starting at position (after opening {).
📍 Line 209
def
def _build_doc_map(source: str) -> dict[int, str]
Map declaration positions to preceding /// doc comments.
📍 Line 222
def
def _clean_rustdoc(raw: str, is_mod: bool = False) -> str
Clean Rust doc comment lines.
📍 Line 230
def
def _parse_rust_params(raw: str) -> list[ArgInfo]
Parse Rust function parameters.
📍 Line 245