pub struct IncrementalParserV2 {
pub reused_nodes: usize,
pub reparsed_nodes: usize,
pub metrics: IncrementalMetrics,
pub last_reuse_analysis: Option<ReuseAnalysisResult>,
/* private fields */
}Expand description
High-performance incremental parser with intelligent AST node reuse
Maintains previous parse state and applies edits incrementally when possible, falling back to full parsing for complex structural changes. Designed for real-time editing scenarios with sub-millisecond update targets.
§Thread Safety
IncrementalParserV2 is not thread-safe and should be used from a single thread. For multi-threaded scenarios, create separate parser instances per thread.
Fields§
§reused_nodes: usize§reparsed_nodes: usize§metrics: IncrementalMetrics§last_reuse_analysis: Option<ReuseAnalysisResult>Performance tracking for reuse analysis
Implementations§
Source§impl IncrementalParserV2
impl IncrementalParserV2
Sourcepub fn with_reuse_config(config: ReuseConfig) -> Self
pub fn with_reuse_config(config: ReuseConfig) -> Self
Create parser with custom reuse configuration
Sourcepub fn parse(&mut self, source: &str) -> ParseResult<Node>
pub fn parse(&mut self, source: &str) -> ParseResult<Node>
Parse source, reusing cached tree nodes where edits did not affect them.
Sourcepub fn get_metrics(&self) -> &IncrementalMetrics
pub fn get_metrics(&self) -> &IncrementalMetrics
Get current performance metrics
Sourcepub fn reset_metrics(&mut self)
pub fn reset_metrics(&mut self)
Reset performance metrics
Sourcepub fn get_last_reuse_analysis(&self) -> Option<&ReuseAnalysisResult>
pub fn get_last_reuse_analysis(&self) -> Option<&ReuseAnalysisResult>
Get the last reuse analysis result if available
Sourcepub fn set_reuse_config(&mut self, config: ReuseConfig)
pub fn set_reuse_config(&mut self, config: ReuseConfig)
Update reuse configuration
Sourcepub fn used_advanced_reuse(&self) -> bool
pub fn used_advanced_reuse(&self) -> bool
Check if the last parse used advanced reuse analysis
Sourcepub fn get_reuse_efficiency_report(&self) -> String
pub fn get_reuse_efficiency_report(&self) -> String
Get detailed reuse efficiency report