qlog::streamer

Struct QlogStreamer

Source
pub struct QlogStreamer { /* private fields */ }

Implementations§

Source§

impl QlogStreamer

Source

pub fn new( qlog_version: String, title: Option<String>, description: Option<String>, summary: Option<String>, start_time: Instant, trace: TraceSeq, log_level: EventImportance, writer: Box<dyn Write + Send + Sync>, ) -> Self

Creates a QlogStreamer object.

It owns a QlogSeq object that contains the provided TraceSeq containing Events.

All serialization will be written to the provided Write using the JSON-SEQ format.

Source

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

Starts qlog streaming serialization.

This writes out the JSON-SEQ-serialized form of all initial qlog information. Events are separately appended using add_event(), add_event_with_instant(), add_event_now(), add_event_data_with_instant(), or add_event_data_now().

Source

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

Finishes qlog streaming serialization.

After this is called, no more serialization will occur.

Source

pub fn add_event_now<E: Serialize + Eventable>( &mut self, event: E, ) -> Result<()>

Writes a serializable to a JSON-SEQ record using std::time::Instant::now().

Source

pub fn add_event_with_instant<E: Serialize + Eventable>( &mut self, event: E, now: Instant, ) -> Result<()>

Writes a serializable to a JSON-SEQ record using the provided std::time::Instant.

Source

pub fn add_event_data_now(&mut self, event_data: EventData) -> Result<()>

Writes an Event based on the provided EventData to a JSON-SEQ record at time std::time::Instant::now().

Source

pub fn add_event_data_ex_now( &mut self, event_data: EventData, ex_data: ExData, ) -> Result<()>

Writes an Event based on the provided EventData and ExData to a JSON-SEQ record at time std::time::Instant::now().

Source

pub fn add_event_data_with_instant( &mut self, event_data: EventData, now: Instant, ) -> Result<()>

Writes an Event based on the provided EventData and std::time::Instant to a JSON-SEQ record.

Source

pub fn add_event_data_ex_with_instant( &mut self, event_data: EventData, ex_data: ExData, now: Instant, ) -> Result<()>

Writes an Event based on the provided EventData, ExData, and std::time::Instant to a JSON-SEQ record.

Source

pub fn add_event<E: Serialize + Eventable>(&mut self, event: E) -> Result<()>

Writes a JSON-SEQ-serialized Event using the provided Event.

Source

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

Returns the writer.

Source

pub fn start_time(&self) -> Instant

Trait Implementations§

Source§

impl Drop for QlogStreamer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.