pub struct Parse { /* private fields */ }Expand description
The result of a parse operation.
A parse result always contains a syntax tree, even if errors occurred. This is essential for IDE use cases where we need to provide feedback even on incomplete or invalid code.
Implementations§
Source§impl Parse
impl Parse
Sourcepub fn syntax(&self) -> SyntaxNode
pub fn syntax(&self) -> SyntaxNode
Get the root syntax node.
Sourcepub fn errors(&self) -> &[ParseError]
pub fn errors(&self) -> &[ParseError]
Get the parse errors.
Sourcepub fn ok(self) -> Result<SyntaxNode, Vec<ParseError>>
pub fn ok(self) -> Result<SyntaxNode, Vec<ParseError>>
Convert to a Result, returning the syntax node on success or errors on failure.
Auto Trait Implementations§
impl Freeze for Parse
impl RefUnwindSafe for Parse
impl Send for Parse
impl Sync for Parse
impl Unpin for Parse
impl UnsafeUnpin for Parse
impl UnwindSafe for Parse
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more