rowan_nom

Struct Children

Source
pub struct Children<Lang: Language, E> { /* private fields */ }
Expand description

A partial green AST builder, used as an output for all parsers

The use of rowan in a parser generally implies that the parser should be as resilient as possible. That is, it shouldn’t return an error. This structure represents the output that a rowan-nom parser should return everywhere. It contains a list of rowan nodes or tokens, and a list of currently accumulated errors. This way, all parser can return Ok and are still able to emit errors.

Most of the time, Children will be built using one of this crate’s parsers.

Implementations§

Source§

impl<Lang: Language, E> Children<Lang, E>

Source

pub fn empty() -> Self

Source

pub fn from_err(error: E) -> Self

Source

pub fn from_rowan_children(children: Children<'_>, errors: Vec<E>) -> Self

Source

pub fn into_node(self, kind: Lang::Kind) -> Self

Source

pub fn into_root_node(self, kind: Lang::Kind) -> (SyntaxNode<Lang>, Vec<E>)

Trait Implementations§

Source§

impl<Lang: Language, E> Add for Children<Lang, E>

Source§

type Output = Children<Lang, E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<Lang: Language, E> AddAssign for Children<Lang, E>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<Lang: Language, E: Debug> Debug for Children<Lang, E>

Source§

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

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

impl<Lang: Language, E> Default for Children<Lang, E>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'src, 'a, Lang: Language, E> FromIterator<&'a (<Lang as Language>::Kind, &'src str)> for Children<Lang, E>

Source§

fn from_iter<T: IntoIterator<Item = &'a (<Lang as Language>::Kind, &'src str)>>( iter: T, ) -> Self

Creates a value from an iterator. Read more
Source§

impl<'src, Lang: Language, E> FromIterator<(<Lang as Language>::Kind, &'src str)> for Children<Lang, E>

Source§

fn from_iter<T: IntoIterator<Item = (<Lang as Language>::Kind, &'src str)>>( iter: T, ) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl<Lang, E> Freeze for Children<Lang, E>

§

impl<Lang, E> RefUnwindSafe for Children<Lang, E>
where Lang: RefUnwindSafe, E: RefUnwindSafe,

§

impl<Lang, E> Send for Children<Lang, E>
where Lang: Send, E: Send,

§

impl<Lang, E> Sync for Children<Lang, E>
where Lang: Sync, E: Sync,

§

impl<Lang, E> Unpin for Children<Lang, E>
where Lang: Unpin, E: Unpin,

§

impl<Lang, E> UnwindSafe for Children<Lang, E>
where Lang: UnwindSafe, E: UnwindSafe,

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 = 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.