pub struct Parse<T> { /* private fields */ }
Expand description
The result of parsing: a syntax tree and a collection of errors.
This type is designed to be stored in Salsa databases as it contains
the thread-safe GreenNode
instead of the non-thread-safe SyntaxNode
.
Implementations§
Source§impl<T> Parse<T>
impl<T> Parse<T>
Sourcepub fn new(green: GreenNode, errors: Vec<String>) -> Parse<T>
pub fn new(green: GreenNode, errors: Vec<String>) -> Parse<T>
Create a new Parse result from a GreenNode and errors
Sourcepub fn new_with_positioned_errors(
green: GreenNode,
errors: Vec<String>,
positioned_errors: Vec<PositionedParseError>,
) -> Parse<T>
pub fn new_with_positioned_errors( green: GreenNode, errors: Vec<String>, positioned_errors: Vec<PositionedParseError>, ) -> Parse<T>
Create a new Parse result from a GreenNode, errors, and positioned errors
Sourcepub fn positioned_errors(&self) -> &[PositionedParseError]
pub fn positioned_errors(&self) -> &[PositionedParseError]
Get parse errors with position information
Sourcepub fn error_messages(&self) -> Vec<String>
pub fn error_messages(&self) -> Vec<String>
Get parse errors as strings (for backward compatibility if needed)
Sourcepub fn to_result(self) -> Result<T, ParseError>
pub fn to_result(self) -> Result<T, ParseError>
Convert to a Result, returning the tree if there are no errors
Sourcepub fn syntax_node(&self) -> SyntaxNode<Lang>
pub fn syntax_node(&self) -> SyntaxNode<Lang>
Get the syntax node
Trait Implementations§
impl<T> Eq for Parse<T>where
T: Eq,
impl<T> Send for Parse<T>
impl<T> StructuralPartialEq for Parse<T>
impl<T> Sync for Parse<T>
Auto Trait Implementations§
impl<T> Freeze for Parse<T>
impl<T> RefUnwindSafe for Parse<T>where
T: RefUnwindSafe,
impl<T> Unpin for Parse<T>where
T: Unpin,
impl<T> UnwindSafe for Parse<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