Enum tree_sitter_graph::parse_error::ParseError

source ·
pub enum ParseError<'tree> {
    Missing(Node<'tree>),
    Unexpected(Node<'tree>),
}
Expand description

Parse error for tree-sitter tree

Variants§

§

Missing(Node<'tree>)

Error representing missing syntax

§

Unexpected(Node<'tree>)

Error representing unexpected syntax

Implementations§

source§

impl<'tree> ParseError<'tree>

source

pub fn first(tree: &Tree) -> Option<ParseError<'_>>

Return the first parse error in the given tree, if it exists.

source

pub fn into_first(tree: Tree) -> TreeWithParseErrorOption

Return the tree and the first parse error in the given tree, if it exists. This returns a type, combining the tree and the error, that can be moved safely, which is not possible with a seperate tree and error.

source

pub fn all(tree: &'tree Tree) -> Vec<ParseError<'_>>

Return all parse errors in the given tree.

source

pub fn into_all(tree: Tree) -> TreeWithParseErrorVec

Return the tree and all parse errors in the given tree. This returns a type, combining the tree and the errors, that can be moved safely, which is not possible with a seperate tree and errors.

source§

impl<'tree> ParseError<'tree>

source

pub fn node(&self) -> &Node<'tree>

source

pub fn display( &'tree self, path: &'tree Path, source: &'tree str ) -> impl Display + 'tree

source

pub fn display_pretty( &'tree self, path: &'tree Path, source: &'tree str ) -> impl Display + 'tree

Trait Implementations§

source§

impl<'tree> Debug for ParseError<'tree>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tree> Freeze for ParseError<'tree>

§

impl<'tree> RefUnwindSafe for ParseError<'tree>

§

impl<'tree> !Send for ParseError<'tree>

§

impl<'tree> !Sync for ParseError<'tree>

§

impl<'tree> Unpin for ParseError<'tree>

§

impl<'tree> UnwindSafe for ParseError<'tree>

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>,

§

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>,

§

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.