Struct Node

Source
pub struct Node<'input, Rule: RuleType, Data> { /* private fields */ }
Expand description

A node of the parse tree.

Implementations§

Source§

impl<'i, R: RuleType, D> Node<'i, R, D>

Source

pub fn as_str(&self) -> &'i str

Source

pub fn as_span(&self) -> Span<'i>

Source

pub fn as_rule(&self) -> R

Source

pub fn into_children(self) -> Nodes<'i, R, D>

Returns an iterator over the children of this node

Source

pub fn children(&self) -> Nodes<'i, R, D>
where D: Clone,

Returns an iterator over the children of this node

Source

pub fn error<S: ToString>(&self, message: S) -> Error<R>

Create an error that points to the span of the node.

Source

pub fn user_data(&self) -> &D

Source

pub fn into_user_data(self) -> D

Source

pub fn as_pair(&self) -> &Pair<'i, R>

Source

pub fn into_pair(self) -> Pair<'i, R>

Trait Implementations§

Source§

impl<'input, Rule: Clone + RuleType, Data: Clone> Clone for Node<'input, Rule, Data>

Source§

fn clone(&self) -> Node<'input, Rule, Data>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'input, Rule: Debug + RuleType, Data: Debug> Debug for Node<'input, Rule, Data>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'i, R: RuleType, D> Display for Node<'i, R, D>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'input, Rule: Hash + RuleType, Data: Hash> Hash for Node<'input, Rule, Data>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'input, Rule: PartialEq + RuleType, Data: PartialEq> PartialEq for Node<'input, Rule, Data>

Source§

fn eq(&self, other: &Node<'input, Rule, Data>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'input, Rule: Eq + RuleType, Data: Eq> Eq for Node<'input, Rule, Data>

Source§

impl<'input, Rule: RuleType, Data> StructuralPartialEq for Node<'input, Rule, Data>

Auto Trait Implementations§

§

impl<'input, Rule, Data> Freeze for Node<'input, Rule, Data>
where Data: Freeze,

§

impl<'input, Rule, Data> RefUnwindSafe for Node<'input, Rule, Data>
where Data: RefUnwindSafe, Rule: RefUnwindSafe,

§

impl<'input, Rule, Data> !Send for Node<'input, Rule, Data>

§

impl<'input, Rule, Data> !Sync for Node<'input, Rule, Data>

§

impl<'input, Rule, Data> Unpin for Node<'input, Rule, Data>
where Data: Unpin,

§

impl<'input, Rule, Data> UnwindSafe for Node<'input, Rule, Data>
where Data: UnwindSafe, Rule: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.