[][src]Struct qlog::QlogStreamer

pub struct QlogStreamer { /* fields omitted */ }

A helper object specialized for streaming JSON-serialized qlog to a Write trait.

The object is responsible for the Qlog object that contains the provided Trace.

Serialization is progressively driven by method calls; once log streaming is started, event::Events can be written using add_event(). Some events can contain an array of QuicFrames, when writing such an event, the streamer enters a frame-serialization mode where frames are be progressively written using add_frame(). This mode is concluded using finished_frames(). While serializing frames, any attempts to log additional events are ignored.

Implementations

impl QlogStreamer[src]

pub fn new(
    qlog_version: String,
    title: Option<String>,
    description: Option<String>,
    summary: Option<String>,
    start_time: Instant,
    trace: Trace,
    writer: Box<dyn Write + Send + Sync>
) -> Self
[src]

Creates a QlogStreamer object.

It owns a Qlog object that contains the provided Trace, which must have the following ordered-set of names EventFields:

["relative_time", "category", "event".to_string(), "data"]

All serialization will be written to the provided Write.

pub fn start_log(&mut self) -> Result<()>[src]

Starts qlog streaming serialization.

This writes out the JSON-serialized form of all information up to qlog Trace's array of EventFields. EventFields are separately appended using functions that accept and event::Event.

pub fn finish_log(&mut self) -> Result<()>[src]

Finishes qlog streaming serialization.

The JSON-serialized output has remaining close delimiters added. After this is called, no more serialization will occur.

pub fn add_event(&mut self, event: Event) -> Result<bool>[src]

Writes a JSON-serialized EventFields.

Some qlog events can contain QuicFrames. If this is detected true is returned and the streamer enters a frame-serialization mode that is only concluded by finish_frames(). In this mode, attempts to log additional events are ignored.

If the event contains no array of QuicFrames return false.

pub fn add_frame(&mut self, frame: QuicFrame, last: bool) -> Result<()>[src]

Writes a JSON-serialized QuicFrame.

Only valid while in the frame-serialization mode.

pub fn finish_frames(&mut self) -> Result<()>[src]

Concludes QuicFrame streaming serialization.

Only valid while in the frame-serialization mode.

pub fn writer(&self) -> &Box<dyn Write + Send + Sync>[src]

Returns the writer.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.