pub enum ParseDelta<'a> {
AddSection(Section<'a>),
UpdateSection(usize, Section<'a>),
RemoveSection(usize),
ParseIssue(String),
}Expand description
Delta operations for streaming updates
Represents atomic changes detected during incremental parsing. Used by editors and streaming applications to efficiently update internal state without full re-parsing.
§Performance
Deltas use zero-copy design where possible to minimize allocations. Section references point to parsed AST nodes using lifetime parameters.
§Example
use ass_core::parser::streaming::ParseDelta;
// Handle delta operations
fn apply_deltas(deltas: Vec<ParseDelta>) {
for delta in deltas {
match delta {
ParseDelta::AddSection(section) => {
// Add new section to document
}
ParseDelta::UpdateSection(index, section) => {
// Update existing section
}
ParseDelta::RemoveSection(index) => {
// Remove section at index
}
ParseDelta::ParseIssue(issue) => {
// Handle parsing error/warning
}
}
}
}Variants§
AddSection(Section<'a>)
Section was added to the script
Contains the complete parsed section with zero-copy references to source text spans.
UpdateSection(usize, Section<'a>)
Section was modified during incremental parsing
Contains the section index and updated section data. Consumers should replace the existing section at the specified index with this new data.
RemoveSection(usize)
Section was removed by index
Contains the zero-based index of the section that should be removed from the script.
ParseIssue(String)
Parsing issue detected during processing
Contains error or warning message about parsing problems. Parsing may continue despite issues for error recovery.
Implementations§
Source§impl<'a> ParseDelta<'a>
impl<'a> ParseDelta<'a>
Sourcepub const fn add_section(section: Section<'a>) -> Self
pub const fn add_section(section: Section<'a>) -> Self
Create delta for adding a section
Sourcepub const fn update_section(index: usize, section: Section<'a>) -> Self
pub const fn update_section(index: usize, section: Section<'a>) -> Self
Create delta for updating a section
Sourcepub const fn remove_section(index: usize) -> Self
pub const fn remove_section(index: usize) -> Self
Create delta for removing a section by index
Sourcepub const fn parse_issue(message: String) -> Self
pub const fn parse_issue(message: String) -> Self
Create delta for parsing issue
Sourcepub const fn is_structural(&self) -> bool
pub const fn is_structural(&self) -> bool
Check if delta modifies document structure
Trait Implementations§
Source§impl<'a> Clone for ParseDelta<'a>
impl<'a> Clone for ParseDelta<'a>
Source§fn clone(&self) -> ParseDelta<'a>
fn clone(&self) -> ParseDelta<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more