Struct prost_build::Comments
source · pub struct Comments {
pub leading_detached: Vec<Vec<String>>,
pub leading: Vec<String>,
pub trailing: Vec<String>,
}Expand description
Comments on a Protobuf item.
Fields§
§leading_detached: Vec<Vec<String>>Leading detached blocks of comments.
leading: Vec<String>Leading comments.
trailing: Vec<String>Trailing comments.
Implementations§
source§impl Comments
impl Comments
sourcepub fn append_with_indent(&self, indent_level: u8, buf: &mut String)
pub fn append_with_indent(&self, indent_level: u8, buf: &mut String)
Appends the comments to a buffer with indentation.
Each level of indentation corresponds to four space (’ ’) characters.
Examples found in repository?
src/code_generator.rs (line 590)
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
fn append_doc(&mut self, fq_name: &str, field_name: Option<&str>) {
let append_doc = if let Some(field_name) = field_name {
self.config
.disable_comments
.get_first_field(fq_name, field_name)
.is_none()
} else {
self.config.disable_comments.get(fq_name).next().is_none()
};
if append_doc {
if let Some(comments) = self.location().map(Comments::from_location) {
comments.append_with_indent(self.depth, self.buf);
}
}
}