Skip to main content

Site

Struct Site 

Source
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<'_>

Source

pub fn root(&self) -> &Value

The verbatim root of the site’s document.

Source

pub fn doc(&self) -> &str

The key of the site’s document.

Source

pub fn path(&self) -> &[Seg]

The path from the document’s root to the site.

Source

pub fn node(&self) -> &Value

The verbatim node at the site: the map, or the operator node.

Source

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.

Source

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.

Source

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.

Source

pub fn locate( &self, path: &[Seg], doc: Option<&str>, ) -> Result<Option<Value>, FoldError>

The raw value at path, following nothing.

Source

pub fn plain(&self) -> Result<Value, FoldError>

This map folded as a plain map, members in their own order, which is what a resolver returns where the operator does not apply.

Trait Implementations§

Source§

impl Debug for Site<'_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'f> !Freeze for Site<'f>

§

impl<'f> !RefUnwindSafe for Site<'f>

§

impl<'f> !Send for Site<'f>

§

impl<'f> !Sync for Site<'f>

§

impl<'f> !UnwindSafe for Site<'f>

§

impl<'f> Forget for Site<'f>

§

impl<'f> Move for Site<'f>

§

impl<'f> Unpin for Site<'f>

§

impl<'f> UnsafeUnpin for Site<'f>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.