pub struct AadPath { /* private fields */ }Expand description
The stack of string mapping keys from the document root down to a leaf.
Push on the way down, pop on the way back up. Descending into a sequence pushes nothing, which is not an omission — see the module docs.
Implementations§
Source§impl AadPath
impl AadPath
Sourcepub fn within<T>(
&mut self,
key: impl Into<String>,
f: impl FnOnce(&mut Self) -> T,
) -> T
pub fn within<T>( &mut self, key: impl Into<String>, f: impl FnOnce(&mut Self) -> T, ) -> T
Run f with key pushed, restoring the path afterwards even if f
returns early.
The manual push/pop pair is the shape that goes wrong under ?, so the
walker uses this instead.
Sourcepub fn components(&self) -> &[String]
pub fn components(&self) -> &[String]
The components, for the selector rules — which test every component, not just the leaf’s own key.
Sourcepub fn aad(&self) -> Aad
pub fn aad(&self) -> Aad
Build the AAD for a leaf at this path.
Exactly strings.Join(path, ":") + ":".
Written as a join-then-append rather than a push-each-with-separator loop,
because the two disagree at depth 0: Go’s Join over an empty slice is
"", so the AAD at the root is a bare ":", whereas the loop form
produces "". That is not a degenerate case nobody reaches — a
top-level comment has an empty path, because walkBranch passes
item.Key to walkValue with path unchanged. The loop form was the
first version of this function and the depth-0 test is what caught it.
Sourcepub fn has_ambiguous_component(&self) -> bool
pub fn has_ambiguous_component(&self) -> bool
Whether any component contains :, which makes this path’s AAD
ambiguous with a differently-nested document.
Upstream neither escapes nor detects this. We reproduce the encoding — the wire is the wire — but we can at least tell a caller, so refusing is a policy decision made in the open instead of a silent collision.