MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / doc_comment

Method doc_comment

cranelift/srcgen/src/lib.rs:171–183  ·  view source on GitHub ↗

Add a (multi-line) documentation comment.

(&mut self, contents: impl AsRef<str>)

Source from the content-addressed store, hash-verified

169
170 /// Add a (multi-line) documentation comment.
171 pub fn doc_comment(&mut self, contents: impl AsRef<str>) {
172 assert!(matches!(self.lang, Language::Rust));
173 parse_multiline(contents.as_ref())
174 .iter()
175 .map(|l| {
176 if l.is_empty() {
177 "///".into()
178 } else {
179 format!("/// {l}")
180 }
181 })
182 .for_each(|s| self.line(s.as_str()));
183 }
184
185 /// Add a brace-delimited block that begins with `start`: i.e., `<start> {
186 /// <f()> }`. This properly indents the contents of the block.

Callers 15

fmt_can_add_doc_commentsFunction · 0.80
gen_constructorFunction · 0.80
gen_iteratorFunction · 0.80
gen_enum_typesFunction · 0.80
gen_getterFunction · 0.80
gen_gettersFunction · 0.80
gen_templateFunction · 0.80
gen_hash_keyFunction · 0.80
gen_groupFunction · 0.80
emit_typeFunction · 0.80
gen_formatsFunction · 0.80

Calls 7

parse_multilineFunction · 0.85
mapMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45
is_emptyMethod · 0.45
lineMethod · 0.45
as_strMethod · 0.45