pub struct XPath(/* private fields */);Expand description
A compiled XPath. Construct via Factory.
Implementations§
Source§impl XPath
impl XPath
Sourcepub fn evaluate<'d, N>(
&self,
context: &Context<'d>,
node: N,
) -> Result<Value<'d>, ExecutionError>
pub fn evaluate<'d, N>( &self, context: &Context<'d>, node: N, ) -> Result<Value<'d>, ExecutionError>
Evaluate this expression in the given context.
§Examples
The most common case is to pass in a reference to a Context:
extern crate sxd_document;
extern crate sxd_xpath;
use sxd_document::dom::Document;
use sxd_xpath::{XPath, Context};
fn my_evaluate(doc: Document, xpath: XPath) {
let mut context = Context::new();
let value = xpath.evaluate(&context, doc.root());
println!("The result was: {:?}", value);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XPath
impl !RefUnwindSafe for XPath
impl !Send for XPath
impl !Sync for XPath
impl Unpin for XPath
impl !UnwindSafe for XPath
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