Evaluation

Struct Evaluation 

Source
pub struct Evaluation<'c, 'd: 'c> {
    pub node: Node<'d>,
    pub position: usize,
    pub size: usize,
    /* private fields */
}
Expand description

The context during evaluation of an XPath expression.

Clients of this library will use this when implementing custom functions.

§Lifetimes

We track two separate lifetimes: that of the user-provided context ('c) and that of the document ('d). This allows the user-provided context to live shorter than the document.

Fields§

§node: Node<'d>

The context node

§position: usize

The context position

§size: usize

The context size

Implementations§

Source§

impl<'c, 'd> Evaluation<'c, 'd>

Source

pub fn new(context: &'c Context<'d>, node: Node<'d>) -> Evaluation<'c, 'd>

Prepares the context used while evaluating the XPath expression

Source

pub fn new_context_for<N>(&self, node: N) -> Evaluation<'c, 'd>
where N: Into<Node<'d>>,

Creates a new context node using the provided node

Source

pub fn function_for_name(&self, name: QName<'_>) -> Option<&'c dyn Function>

Looks up the function with the given name

Source

pub fn value_of(&self, name: QName<'_>) -> Option<&Value<'d>>

Looks up the value of the variable

Source

pub fn namespace_for(&self, prefix: &str) -> Option<&str>

Looks up the namespace URI for the given prefix

Source

pub fn new_contexts_for( self, nodes: OrderedNodes<'d>, ) -> EvaluationNodesetIter<'c, 'd>

Yields a new Evaluation context for each node in the nodeset.

Trait Implementations§

Source§

impl<'c, 'd: 'c> Clone for Evaluation<'c, 'd>

Source§

fn clone(&self) -> Evaluation<'c, 'd>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'c, 'd: 'c> Copy for Evaluation<'c, 'd>

Auto Trait Implementations§

§

impl<'c, 'd> Freeze for Evaluation<'c, 'd>

§

impl<'c, 'd> !RefUnwindSafe for Evaluation<'c, 'd>

§

impl<'c, 'd> !Send for Evaluation<'c, 'd>

§

impl<'c, 'd> !Sync for Evaluation<'c, 'd>

§

impl<'c, 'd> Unpin for Evaluation<'c, 'd>

§

impl<'c, 'd> !UnwindSafe for Evaluation<'c, 'd>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.