ParseDelta

Enum ParseDelta 

Source
pub enum ParseDelta<'a> {
    AddSection(Section<'a>),
    UpdateSection(usize, Section<'a>),
    RemoveSection(usize),
    ParseIssue(String),
}
Available on crate feature stream only.
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>

Source

pub const fn add_section(section: Section<'a>) -> Self

Create delta for adding a section

Source

pub const fn update_section(index: usize, section: Section<'a>) -> Self

Create delta for updating a section

Source

pub const fn remove_section(index: usize) -> Self

Create delta for removing a section by index

Source

pub const fn parse_issue(message: String) -> Self

Create delta for parsing issue

Source

pub const fn is_error(&self) -> bool

Check if delta represents an error condition

Source

pub const fn is_structural(&self) -> bool

Check if delta modifies document structure

Source

pub const fn section(&self) -> Option<&Section<'a>>

Get section reference if delta contains one

Trait Implementations§

Source§

impl<'a> Clone for ParseDelta<'a>

Source§

fn clone(&self) -> ParseDelta<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ParseDelta<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> FromIterator<ParseDelta<'a>> for DeltaBatch<'a>

Source§

fn from_iter<T: IntoIterator<Item = ParseDelta<'a>>>(iter: T) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ParseDelta<'a>

§

impl<'a> RefUnwindSafe for ParseDelta<'a>

§

impl<'a> Send for ParseDelta<'a>

§

impl<'a> Sync for ParseDelta<'a>

§

impl<'a> Unpin for ParseDelta<'a>

§

impl<'a> UnwindSafe for ParseDelta<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.