pub struct NodeMeta<Loc = Span> {
pub anchor: Option<String>,
pub anchor_loc: Option<Loc>,
pub tag_loc: Option<Loc>,
pub leading_comments: Option<Vec<String>>,
pub trailing_comment: Option<String>,
}Expand description
Rare per-node fields that are absent on most nodes in typical documents.
Bundled behind Option<Box<NodeMeta>> on Node::Scalar, Node::Mapping,
and Node::Sequence so that the common case (no anchor, no user-authored
tag location, no comments) pays only one 8-byte pointer instead of ~200
bytes of inline storage. When meta is None all five fields read as
their zero/empty defaults via the Node accessor methods.
Fields§
§anchor: Option<String>Anchor name defined on this node (e.g. &anchor), if any.
anchor_loc: Option<Loc>Source span of the &name anchor token — from & through the last byte of the
name. Some when anchor is Some; None otherwise.
tag_loc: Option<Loc>Source span of the tag token — from ! through the last byte of the tag.
Some when a user-authored tag is present; None for resolver-injected tags.
leading_comments: Option<Vec<String>>Comment lines that appear before this node (e.g. # note).
Populated only for non-first entries in a mapping or sequence.
Document-prefix leading comments are discarded by the tokenizer
per YAML §9.2 and cannot be recovered here.
trailing_comment: Option<String>Inline comment on the same line as this node (e.g. # note).