pub struct ParseTreeMatch<'subject> { /* private fields */ }Expand description
The result of matching a subject tree against a ParseTreePattern.
Holds the label bindings discovered during the match and, on failure, the first subject node that did not match. Borrows the subject tree.
Implementations§
Source§impl<'subject> ParseTreeMatch<'subject>
impl<'subject> ParseTreeMatch<'subject>
Sourcepub const fn succeeded(&self) -> bool
pub const fn succeeded(&self) -> bool
Returns whether the match succeeded (no node mismatched).
Sourcepub const fn mismatched_node(&self) -> Option<Node<'subject>>
pub const fn mismatched_node(&self) -> Option<Node<'subject>>
The first subject node that failed to match, or None on success.
Sourcepub fn get(&self, label: &str) -> Option<Node<'subject>>
pub fn get(&self, label: &str) -> Option<Node<'subject>>
The last node bound to label, or None if nothing matched it.
Unlabeled tags <ID>/<expr> are filed under their rule/token name, so
get("expr") returns a node matched by <expr>.
Trait Implementations§
Source§impl<'subject> Clone for ParseTreeMatch<'subject>
impl<'subject> Clone for ParseTreeMatch<'subject>
Source§fn clone(&self) -> ParseTreeMatch<'subject>
fn clone(&self) -> ParseTreeMatch<'subject>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'subject> !RefUnwindSafe for ParseTreeMatch<'subject>
impl<'subject> !Send for ParseTreeMatch<'subject>
impl<'subject> !Sync for ParseTreeMatch<'subject>
impl<'subject> !UnwindSafe for ParseTreeMatch<'subject>
impl<'subject> Freeze for ParseTreeMatch<'subject>
impl<'subject> Unpin for ParseTreeMatch<'subject>
impl<'subject> UnsafeUnpin for ParseTreeMatch<'subject>
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