Struct qlog::streamer::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>,

§

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>,

§

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.