Skip to main content

WalkQuery

Struct WalkQuery 

Source
pub struct WalkQuery { /* private fields */ }
Expand description

A parsed query inside the walk’s grammar (see the module doc).

Implementations§

Source§

impl WalkQuery

Source

pub fn parse(xpath: &str) -> Option<WalkQuery>

The query xpath as a walk, or None when it is outside the grammar: a union (|) of //STEP, //A//STEP or //A/STEP arms (A a bare name test), or of descendant::STEP / .//STEP / descendant-or-self::STEP arms, where STEP is * or ltx:NAME with at most one predicate of or/and-joined atoms (no parentheses).

Source

pub fn find(&self, doc: &Document, context: Option<&Node>) -> Option<Vec<Node>>

The query’s matches in doc, in document order, each once: XPath’s answer, evaluated at context (or at the root element when None, as LaTeXML’s findnodes binds it). None when the walk cannot vouch for that: no root, a null context or one outside doc’s tree (a detached or foreign node: XPath decides how it fails), or a DTD (its default attributes and entity references are seen differently by XPath than by a tree walk).

Source

pub fn find_first( &self, doc: &Document, context: Option<&Node>, ) -> Option<Option<Node>>

The first of find’s matches (Some(None): none), the walk stopping there.

Trait Implementations§

Source§

impl Debug for WalkQuery

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.