pub struct AnyParse { /* private fields */ }
Expand description
Language-independent cache entry for a parsed file
This struct holds a handle to the root node of the parsed syntax tree, along with the list of diagnostics emitted by the parser while generating this entry.
It can be dynamically downcast into a concrete SyntaxNode or AstNode of the corresponding language, generally through a language-specific capability
Implementations§
Source§impl AnyParse
impl AnyParse
pub fn new(root: SendNode, diagnostics: Vec<ParseDiagnostic>) -> AnyParse
pub fn syntax<L>(&self) -> SyntaxNode<L>where
L: Language + 'static,
pub fn tree<N>(&self) -> N
Sourcepub fn into_diagnostics(self) -> Vec<Diagnostic>
pub fn into_diagnostics(self) -> Vec<Diagnostic>
This function transforms diagnostics coming from the parser into serializable diagnostics
Sourcepub fn diagnostics(&self) -> &[ParseDiagnostic]
pub fn diagnostics(&self) -> &[ParseDiagnostic]
Get the diagnostics which occurred when parsing
pub fn has_errors(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnyParse
impl RefUnwindSafe for AnyParse
impl Send for AnyParse
impl Sync for AnyParse
impl Unpin for AnyParse
impl UnwindSafe for AnyParse
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