Add option to emit C++ comments as ///

This commit is contained in:
David Tolnay 2022-11-18 00:11:17 -08:00
parent c16f037b8a
commit a628611897
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,7 @@ pub struct Opt {
pub(super) gen_implementation: bool,
pub(super) allow_dot_includes: bool,
pub(super) cfg_evaluator: Box<dyn CfgEvaluator>,
pub(super) doxygen: bool,
}
pub(super) trait CfgEvaluator {
@ -89,6 +90,7 @@ impl Default for Opt {
gen_implementation: true,
allow_dot_includes: true,
cfg_evaluator: Box::new(UnsupportedCfgEvaluator),
doxygen: false,
}
}
}

View File

@ -229,7 +229,11 @@ fn pick_includes_and_builtins(out: &mut OutFile, apis: &[Api]) {
fn write_doc(out: &mut OutFile, indent: &str, doc: &Doc) {
for line in doc.to_string().lines() {
writeln!(out, "{}//{}", indent, line);
if out.opt.doxygen {
writeln!(out, "{}///{}", indent, line);
} else {
writeln!(out, "{}//{}", indent, line);
}
}
}