pub struct Parsed<T> {
pub ast: T,
pub syntax_tree: SyntaxTree,
pub diagnostics: Vec<Diagnostic>,
}Available on crate feature
parser only.Expand description
The result of parsing some source code: an AST, the syntax tree it was lowered from, and any diagnostics.
Fields§
§ast: TThe abstract syntax tree. If there were errors, parts of it may be error nodes.
syntax_tree: SyntaxTreeThe lossless concrete syntax tree that the AST was lowered from.
diagnostics: Vec<Diagnostic>All the diagnostics (errors and warnings) produced while parsing, sorted by where they occur in the source.
Implementations§
Source§impl<T> Parsed<T>
impl<T> Parsed<T>
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Were any errors (as opposed to warnings) reported while parsing?
Sourcepub fn into_result(self) -> Result<T, Vec<Diagnostic>>
pub fn into_result(self) -> Result<T, Vec<Diagnostic>>
Get the AST if no errors were reported, or the diagnostics otherwise. Warnings are discarded.
Trait Implementations§
Auto Trait Implementations§
impl<T> Forget for Parsed<T>
impl<T> Freeze for Parsed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Parsed<T>where
T: RefUnwindSafe,
impl<T> Send for Parsed<T>where
T: Send,
impl<T> Sync for Parsed<T>where
T: Sync,
impl<T> Unpin for Parsed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Parsed<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Parsed<T>where
T: UnwindSafe,
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