Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource {
    // Required method
    fn next_event(&mut self) -> Result<Option<Event>>;
}
Expand description

Produces a stream of crate::Events from a document source.

The pull-based design gives the consumer control: only fetch events when ready to process them. This provides natural backpressure and constant memory usage regardless of document size.

Return Ok(None) to signal the end of the stream. Return Err for fatal errors that prevent further reading.

Required Methods§

Source

fn next_event(&mut self) -> Result<Option<Event>>

Returns the next event from the stream, or None if the stream has ended.

§Errors

Returns an error if the source encounters a fatal problem (malformed input, truncated stream, I/O failure). After an error, the stream is considered terminated.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§