Module streaming

Module streaming 

Source
Available on crate feature stream only.
Expand description

Streaming and incremental parsing for ASS scripts

Provides efficient streaming parsing capabilities with true incremental processing through state machine design. Enables <5ms responsiveness for large files and editor integration.

§Features

  • True streaming: Process chunks without loading entire file
  • State machine: Handle partial lines and incomplete sections
  • Delta tracking: Efficient change representation for editors
  • Memory efficiency: O(line) not O(file) memory usage

§Performance

  • Target: <5ms per 1MB chunk processing
  • Memory: <1.1x input size peak usage
  • Incremental: <2ms for single-event edits
  • Supports files up to 2GB on 64-bit systems

§Example

use ass_core::parser::streaming::StreamingParser;

let mut parser = StreamingParser::new();

// Process chunks incrementally
let chunk1 = b"[Script Info]\nTitle: Example\n";
let deltas1 = parser.feed_chunk(chunk1)?;

let chunk2 = b"[Events]\nFormat: Layer, Start, End\n";
let deltas2 = parser.feed_chunk(chunk2)?;

let result = parser.finish()?;

Structs§

DeltaBatch
Collection of parse deltas with batch operations
LineProcessor
Line processor for streaming ASS parser
StreamingContext
Context for streaming parser state
StreamingParser
High-performance streaming parser for ASS scripts
StreamingResult
Result of streaming parser containing owned sections

Enums§

ParseDelta
Delta operations for streaming updates
ParserState
Streaming parser state for incremental processing
SectionKind
Section types for state tracking

Functions§

build_modified_source
Build modified source with range replacement