pub struct XPath { /* private fields */ }Expand description
A compiled ANTLR parse-tree XPath expression.
Implementations§
Source§impl XPath
impl XPath
Sourcepub fn new<R>(recognizer: &R, path: &str) -> Result<Self, XPathError>where
R: Recognizer + ?Sized,
pub fn new<R>(recognizer: &R, path: &str) -> Result<Self, XPathError>where
R: Recognizer + ?Sized,
Compiles path against the rule and token names exposed by recognizer.
Sourcepub fn evaluate<'tree>(&self, root: Node<'tree>) -> Vec<Node<'tree>>
pub fn evaluate<'tree>(&self, root: Node<'tree>) -> Vec<Node<'tree>>
Evaluates this expression relative to root.
Results retain parse-tree order and contain each node at most once.
ANTLR’s synthetic evaluation root is retained between path steps so a
wildcard prefix can select root later. A final synthetic-root match is
omitted because it is not part of the caller’s parse tree.
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 UnsafeUnpin 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