pub struct Path(/* private fields */);Expand description
The path locating an element in its Document, such as
$.charging_periods[0].dimensions.
A warning is reported against a path, so this is what tells a caller which field a warning is about.
The notation is an RFC 9535 singular query, the RFC’s term for an expression that selects
at most one node. The RFC’s Normalized Path is the one canonical spelling of such a query
and writes this same location as $['charging_periods'][0]['dimensions'], so the shorthand
here is a choice about legibility.
That holds for every field OCPI defines. A key holding a . or a [ is written after a dot
like any other, so a document carrying one can produce two elements with the same path.
A path holds a field name with its escapes decoded, so the field "\u0061ge"
has the path $.age.
Implementations§
Source§impl Path
impl Path
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consume the Path and return the underlying String.
Sourcepub fn components(&self) -> Components<'_> ⓘ
pub fn components(&self) -> Components<'_> ⓘ
Iterate the Components of this path in order, skipping the $ root.
For example, $.elements[0].id yields Member("elements"),
Index("0"), Member("id"). The root path $ yields nothing.