pub struct Site<'f> { /* private fields */ }Expand description
What fold hands its callbacks for one map, or one token operator
node: where it is, what it is, and the ways to reach the rest of the
tree. at, plain, locate and k re-enter the fold, which is
what a resolver does to fold the target of a reference.
Implementations§
Source§impl Site<'_>
impl Site<'_>
Sourcepub fn k(&self) -> Result<Value, FoldError>
pub fn k(&self) -> Result<Value, FoldError>
The bag inherited along the path: FoldOptions::inherit applied
at every map from the root down to and including this one, each
map’s bag kept, so a site reached early through a reference gets
its own ancestors’ bag, never the referrer’s. Inside an inherit
call it is the parent’s bag.
Sourcepub fn token(&self) -> Option<Token>
pub fn token(&self) -> Option<Token>
A position for the site. At a token operator site, the token the
operator OCCURRENCE was matched from, as crate::EvalSite::token
gives it. At a map, what FoldOptions::positions says, if it is
set: this crate records no opening tokens of its own, so without a
host’s lookup it is None.
Sourcepub fn at(&self, path: &[Seg], doc: Option<&str>) -> Result<FoldHit, FoldError>
pub fn at(&self, path: &[Seg], doc: Option<&str>) -> Result<FoldHit, FoldError>
The folded value at path in this document, or in the document
doc, through any key operator site on the way: a pointer may pass
through a $ref to reach a member of its target. A target still
being folded closes a cycle, and so does a path through a site that
was cut. A hit never carries a value when cycle is set.
Sourcepub fn written(
&self,
path: &[Seg],
doc: Option<&str>,
) -> Result<FoldHit, FoldError>
pub fn written( &self, path: &[Seg], doc: Option<&str>, ) -> Result<FoldHit, FoldError>
The folded value at path as the document is written. Raw members
are followed from the root, and a key operator site met on the way
is stepped through as the map it is, where Site::at folds it and
reads on in its folded value. Only the location named is folded, so
a member beside a site’s key reads as it is written. A target still
being folded closes a cycle.