Skip to main content

read_streaming

Function read_streaming 

pub fn read_streaming(
    reader: impl Read,
    limits: ReadLimits,
    on_event: impl FnMut(Event) -> Result<(), Box<dyn Error + Sync + Send>>,
) -> Result<QlogFile, Box<dyn Error + Sync + Send>>
Available on crate features quic and std only.
Expand description

Read a qlog file from a stream, handing each event to on_event as it is decoded.

The returned QlogFile carries the file and trace metadata with empty Trace::events: what to keep of an event is the caller’s choice, so a viewer can render one and drop its JSON instead of holding the whole capture.

A JSON text sequence is decoded one record at a time, so the source bytes are never held whole either. A contained JSON file is a single document and is parsed as one, bounded by ReadLimits::max_contained_bytes.