pub fn detect_style(input: &str) -> StyleExpand description
Detect the docstring style from its content.
Uses heuristics to identify the style:
- NumPy: Section headers followed by
---underlines - Google: Section headers ending with
:(e.g.,Args:,Returns:) - Falls back to
Googleif no style-specific patterns are found
ยงExample
use pydocstring::detect_style;
use pydocstring::Style;
let numpy = "Summary.\n\nParameters\n----------\nx : int\n Description.";
assert_eq!(detect_style(numpy), Style::NumPy);
let google = "Summary.\n\nArgs:\n x: Description.";
assert_eq!(detect_style(google), Style::Google);