pub struct StreamingParser<'a> {Show 13 fields
scanner: Option<BasicScanner>,
zero_scanner: Option<ZeroScanner<'a>>,
config: StreamingConfig,
event_buffer: VecDeque<Event>,
state: ParserState,
state_stack: Vec<ParserState>,
position: Position,
depth: usize,
pending_anchor: Option<String>,
pending_tag: Option<String>,
stats: Option<StreamingStats>,
start_time: Instant,
stream_ended: bool,
}Expand description
Streaming YAML parser that processes events on demand
Fields§
§scanner: Option<BasicScanner>Traditional scanner for compatibility
zero_scanner: Option<ZeroScanner<'a>>Zero-copy scanner for optimized parsing
config: StreamingConfigConfiguration
event_buffer: VecDeque<Event>Event buffer for batched processing
state: ParserStateCurrent parser state
state_stack: Vec<ParserState>State stack for nested structures
position: PositionCurrent position
depth: usizeCurrent nesting depth
pending_anchor: Option<String>Pending anchor for next node
pending_tag: Option<String>Pending tag for next node
stats: Option<StreamingStats>Statistics (if enabled)
start_time: InstantStart time for performance measurement
stream_ended: boolWhether the stream has ended
Implementations§
Source§impl<'a> StreamingParser<'a>
impl<'a> StreamingParser<'a>
Sourcepub fn new(input: String, config: StreamingConfig) -> StreamingParser<'static>
pub fn new(input: String, config: StreamingConfig) -> StreamingParser<'static>
Create a new streaming parser with traditional scanner
Sourcepub fn new_zero_copy(input: &'a str, config: StreamingConfig) -> Self
pub fn new_zero_copy(input: &'a str, config: StreamingConfig) -> Self
Create a new streaming parser with zero-copy scanner
Sourcepub fn next_batch(&mut self) -> Result<Vec<Event>>
pub fn next_batch(&mut self) -> Result<Vec<Event>>
Get the next batch of events
Sourcefn next_event_internal(&mut self) -> Result<Option<Event>>
fn next_event_internal(&mut self) -> Result<Option<Event>>
Get the next event from buffer or generate a new one
Sourcefn generate_events(&mut self) -> Result<()>
fn generate_events(&mut self) -> Result<()>
Generate events by processing tokens
Sourcefn generate_events_zero_copy(&mut self) -> Result<()>
fn generate_events_zero_copy(&mut self) -> Result<()>
Generate events using zero-copy scanner
Sourcefn generate_events_traditional(&mut self) -> Result<()>
fn generate_events_traditional(&mut self) -> Result<()>
Generate events using traditional scanner
Sourcefn is_document_start_candidate_simple(&self) -> bool
fn is_document_start_candidate_simple(&self) -> bool
Check if this position could be document start (—) - simplified version
Sourcefn is_document_end_candidate_simple(&self) -> bool
fn is_document_end_candidate_simple(&self) -> bool
Check if this position could be document end (…) - simplified version
Sourcefn is_value_indicator_simple(&self) -> bool
fn is_value_indicator_simple(&self) -> bool
Check if colon is a value indicator - simplified version
Sourcefn handle_document_start(&mut self)
fn handle_document_start(&mut self)
Handle document start
Sourcefn handle_document_end(&mut self)
fn handle_document_end(&mut self)
Handle document end
Sourcefn handle_flow_sequence_start(&mut self)
fn handle_flow_sequence_start(&mut self)
Handle flow sequence start
Sourcefn handle_flow_sequence_end(&mut self)
fn handle_flow_sequence_end(&mut self)
Handle flow sequence end
Sourcefn handle_flow_mapping_start(&mut self)
fn handle_flow_mapping_start(&mut self)
Handle flow mapping start
Sourcefn handle_flow_mapping_end(&mut self)
fn handle_flow_mapping_end(&mut self)
Handle flow mapping end
Sourcefn handle_value_indicator(&mut self)
fn handle_value_indicator(&mut self)
Handle value indicator (:)
Sourcefn handle_zero_copy_scalar(&mut self, token: ZeroToken<'_>) -> Result<()>
fn handle_zero_copy_scalar(&mut self, token: ZeroToken<'_>) -> Result<()>
Handle zero-copy scalar token
Sourcefn skip_comment_simple(&mut self)
fn skip_comment_simple(&mut self)
Skip comment line - simplified version
Sourcefn process_token(&mut self, token: Token) -> Result<()>
fn process_token(&mut self, token: Token) -> Result<()>
Process a token from traditional scanner
Sourcefn push_state(&mut self, new_state: ParserState)
fn push_state(&mut self, new_state: ParserState)
Push a new state onto the stack
Sourcefn update_stats_for_event(&mut self, _event: &Event)
fn update_stats_for_event(&mut self, _event: &Event)
Update statistics for processed event
Sourcepub fn get_stats(&mut self) -> Option<StreamingStats>
pub fn get_stats(&mut self) -> Option<StreamingStats>
Get current parsing statistics
Sourcepub fn has_more_events(&self) -> bool
pub fn has_more_events(&self) -> bool
Check if more events are available
Sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Get the current buffer size