Skip to main content

JsonlSink

Struct JsonlSink 

Source
pub struct JsonlSink<W: Write + Send> { /* private fields */ }
Expand description

Writes one JSON object per line to W, flushing after every event so a trace is visible as it happens rather than only at exit.

The writer is behind a lock so that a line written from a task thread is written whole: concurrent tasks produce events at the same time, and half a JSON object is not a trace line.

Implementations§

Source§

impl<W: Write + Send> JsonlSink<W>

Source

pub fn new(writer: W, header: TraceHeader) -> Self

Writes trace lines to writer, starting with the header line that declares the format version, the backend that is about to run, the value capture mode, and the entry the run started.

Trait Implementations§

Source§

impl<W: Write + Send> TraceSink for JsonlSink<W>

Source§

fn record(&self, event: TraceEvent)

Records one event. Must not panic: a broken trace sink should degrade the trace, not the program being traced.
Source§

fn is_recording(&self) -> bool

Whether anything will read what is recorded. Read more

Auto Trait Implementations§

§

impl<W> !Freeze for JsonlSink<W>

§

impl<W> RefUnwindSafe for JsonlSink<W>

§

impl<W> Send for JsonlSink<W>

§

impl<W> Sync for JsonlSink<W>

§

impl<W> Unpin for JsonlSink<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for JsonlSink<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for JsonlSink<W>

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.