pyo3_stub_gen/generate/docstring.rs
1use std::fmt;
2
3pub fn write_docstring(f: &mut fmt::Formatter, doc: &str, indent: &str) -> fmt::Result {
4 let doc = doc.trim();
5 if !doc.is_empty() {
6 writeln!(f, r#"{indent}r""""#)?;
7 for line in doc.lines() {
8 writeln!(f, "{indent}{line}")?;
9 }
10 writeln!(f, r#"{indent}""""#)?;
11 }
12 Ok(())
13}