pub struct DocumentAnchor {
pub anchor_name: String,
pub anchor_path: String,
pub aliases: Vec<String>,
}
Expand description
A structure that describes anchors and aliases in a YAML document.
The anchor name, prefixed in the YAML document with “&”, is represented
without the prefix in anchor_name
.
The anchor_path
is a string that denotes the path to the anchor in the YAML
document. Each key that form the path is separated from one another by “/”.
The aliases
vector contains the path to each reference to the anchor in
the YAML document.
§Examples
The following YAML document:
a:
enum: &io
INPUT: 0
OUTPUT: 1
b:
enum: *io
c:
enum: *io
Is represented by the following DocumentAnchor
:
DocumentAnchor {
anchor_name: "io",
anchor_path: "/a/enum",
aliases: ["/b/enum", "/c/enum"],
}
Fields§
§anchor_name: String
The name of the anchor, without the “&” prefix.
anchor_path: String
The path to the anchor in the YAML document, with keys separated by “/”. A “/” at the beginning of the path denotes the root of the YAML document.
aliases: Vec<String>
The path to each alias that references the anchor in the YAML document. Each key that form the alias path is separated by “/”. A “/” at the beginning of the path denotes the root of the YAML document.