Skip to main content

Emitter

Trait Emitter 

Source
pub trait Emitter: Send + Sync {
    // Required methods
    fn buffer(&self) -> Buffer;
    fn print(&self, buffer: Buffer) -> Result<(), Report>;
}
Expand description

The Emitter trait is used for controlling how diagnostics are displayed.

An Emitter must produce a [Buffer] for use by the rendering internals, and its own print implementation.

When a diagnostic is being emitted, a new [Buffer] is allocated, the diagnostic is rendered into it, and then the buffer is passed to print for display by the Emitter implementation.

Required Methods§

Source

fn buffer(&self) -> Buffer

Construct a new [Buffer] for use by the renderer

Source

fn print(&self, buffer: Buffer) -> Result<(), Report>

Display the contents of the given [Buffer]

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Emitter for CaptureEmitter

Available on crate feature std only.
Source§

impl Emitter for DefaultEmitter

Source§

impl Emitter for NullEmitter