Skip to main content

QlogEncoder

Trait QlogEncoder 

pub trait QlogEncoder: Send {
    // Required methods
    fn begin<W>(
        &mut self,
        info: &TraceInfo,
        output: &mut W,
    ) -> impl Future<Output = Result<(), Error>> + Send
       where W: AsyncWrite + Unpin + Send;
    fn event<W>(
        &mut self,
        info: &TraceInfo,
        event: &QlogEventView<'_>,
        output: &mut W,
    ) -> impl Future<Output = Result<(), Error>> + Send
       where W: AsyncWrite + Unpin + Send;

    // Provided method
    fn finish<W>(
        &mut self,
        _output: &mut W,
    ) -> impl Future<Output = Result<(), Error>> + Send
       where W: AsyncWrite + Unpin + Send { ... }
}
Available on crate features quic and std only.
Expand description

Streaming asynchronous serialization of borrowed events to caller-provided output. Encoders can suspend at I/O backpressure without blocking an executor thread.

Required Methods§

fn begin<W>( &mut self, info: &TraceInfo, output: &mut W, ) -> impl Future<Output = Result<(), Error>> + Send
where W: AsyncWrite + Unpin + Send,

Write trace metadata before the first event.

fn event<W>( &mut self, info: &TraceInfo, event: &QlogEventView<'_>, output: &mut W, ) -> impl Future<Output = Result<(), Error>> + Send
where W: AsyncWrite + Unpin + Send,

Encode one borrowed observation, awaiting destination capacity as needed.

Provided Methods§

fn finish<W>( &mut self, _output: &mut W, ) -> impl Future<Output = Result<(), Error>> + Send
where W: AsyncWrite + Unpin + Send,

Write format-specific closing data. The owning output then flushes and shuts down the destination.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§