pub trait Parser<L: Language> {
// Required method
fn parse_incremental(
&self,
text: impl Source,
changed: usize,
cache: IncrementalCache<'_, L>,
) -> ParseOutput<L>;
// Provided method
fn parse(&self, text: impl Source) -> ParseOutput<L> { ... }
}Expand description
Parser trait for converting tokens into kind trees.
This trait provides a unified interface for parsing source text into green kind trees, supporting both full parsing and incremental updates.
Required Methods§
Sourcefn parse_incremental(
&self,
text: impl Source,
changed: usize,
cache: IncrementalCache<'_, L>,
) -> ParseOutput<L>
fn parse_incremental( &self, text: impl Source, changed: usize, cache: IncrementalCache<'_, L>, ) -> ParseOutput<L>
Parses source text incrementally using an existing cache.
This method enables efficient re-parsing by reusing information from previous parsing operations, only processing the changed portions of the source text.
§Arguments
text- The source text to parsechanged- The number of bytes that have changed since the last parsecache- The incremental cache containing previous parsing results
§Returns
A parse output containing either the green kind tree or errors
Provided Methods§
Sourcefn parse(&self, text: impl Source) -> ParseOutput<L>
fn parse(&self, text: impl Source) -> ParseOutput<L>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.