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>) -> Self
pub fn new(green: GreenNode, errors: Vec<String>) -> Self
Create a new Parse result from a GreenNode and errors
Sourcepub fn to_result(self) -> Result<T, ParseError>where
T: AstNode<Language = Lang>,
pub fn to_result(self) -> Result<T, ParseError>where
T: AstNode<Language = Lang>,
Convert to a Result, returning the tree if there are no errors
Sourcepub fn to_mut_result(self) -> Result<T, ParseError>where
T: AstNode<Language = Lang>,
pub fn to_mut_result(self) -> Result<T, ParseError>where
T: AstNode<Language = Lang>,
Convert to a Result, returning a mutable tree if there are no errors
Sourcepub fn tree(&self) -> Twhere
T: AstNode<Language = Lang>,
pub fn tree(&self) -> Twhere
T: AstNode<Language = Lang>,
Get the parsed syntax tree, panicking if there are 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>
impl<T> Send 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