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: usizeThe context position
size: usizeThe context size
Implementations§
Source§impl<'c, 'd> Evaluation<'c, 'd>
impl<'c, 'd> Evaluation<'c, 'd>
Sourcepub fn new(context: &'c Context<'d>, node: Node<'d>) -> Evaluation<'c, 'd>
pub fn new(context: &'c Context<'d>, node: Node<'d>) -> Evaluation<'c, 'd>
Prepares the context used while evaluating the XPath expression
Sourcepub fn new_context_for<N>(&self, node: N) -> Evaluation<'c, 'd>
pub fn new_context_for<N>(&self, node: N) -> Evaluation<'c, 'd>
Creates a new context node using the provided node
Sourcepub fn function_for_name(&self, name: QName<'_>) -> Option<&'c dyn Function>
pub fn function_for_name(&self, name: QName<'_>) -> Option<&'c dyn Function>
Looks up the function with the given name
Sourcepub fn value_of(&self, name: QName<'_>) -> Option<&Value<'d>>
pub fn value_of(&self, name: QName<'_>) -> Option<&Value<'d>>
Looks up the value of the variable
Sourcepub fn namespace_for(&self, prefix: &str) -> Option<&str>
pub fn namespace_for(&self, prefix: &str) -> Option<&str>
Looks up the namespace URI for the given prefix
Sourcepub fn new_contexts_for(
self,
nodes: OrderedNodes<'d>,
) -> EvaluationNodesetIter<'c, 'd> ⓘ
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>
impl<'c, 'd: 'c> Clone for Evaluation<'c, 'd>
Source§fn clone(&self) -> Evaluation<'c, 'd>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more