[−][src]Struct qlog::QlogStreamer
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 QuicFrame
s, 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]
qlog_version: String,
title: Option<String>,
description: Option<String>,
summary: Option<String>,
start_time: Instant,
trace: Trace,
writer: Box<dyn Write + Send + Sync>
) -> Self
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 EventField
s. 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 EventField
s.
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
impl !RefUnwindSafe for QlogStreamer
[src]
impl Send for QlogStreamer
[src]
impl Sync for QlogStreamer
[src]
impl Unpin for QlogStreamer
[src]
impl !UnwindSafe for QlogStreamer
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,