pub struct Comments { /* private fields */ }Expand description
The comments a node owns (Document::comments), each list in
source order.
A mapping entry is named by its key: its leading and trailing
comments are read from the key’s handle (see NodeRef::key); a value
written on the line below its key (k:⏎ # c⏎ v) has leading comments
of its own.
Implementations§
Source§impl Comments
impl Comments
Sourcepub fn leading(&self) -> &[Comment]
pub fn leading(&self) -> &[Comment]
The comment lines above the entry, item, or node (rules 3, 4, 9–13).
Sourcepub fn trailing(&self) -> &[Comment]
pub fn trailing(&self) -> &[Comment]
The same-line comments (rule 5): usually one, on the entry’s first line; an entry whose flow value spans lines can also have one after its closing bracket.
The footer of a collection (rules 6 and 9): the comment lines after its last entry (block), or before its closing bracket (flow).
Sourcepub fn blank_lines_before(&self) -> usize
pub fn blank_lines_before(&self) -> usize
Blank lines right above the line where the entry, item, or node starts (rule 8; below its leading comments, if any); 0 when it does not start its line.