Skip to main content

BatchEmitter

Struct BatchEmitter 

Source
pub struct BatchEmitter<'e> { /* private fields */ }
Expand description

Emitter that delays the emission of diagnostics until an explicit commit.

BatchEmitter is useful whenever any sort of error recovery is possible, thus allowing to ignore the diagnostics associated with the recovered error.

BatchEmitter works by relaying all the received diagnostics to an inner Emitter instance, but only after a call to BatchEmitter::commit. If the object is destroyed before a call to BatchEmitter::commit, the pending dianostics are discarded.

Implementations§

Source§

impl<'e> BatchEmitter<'e>

Source

pub fn new(emitter: &'e dyn Emitter) -> BatchEmitter<'e>

Constructs a new BatchEmitter relaying to the provided Emitter instance.

Source

pub fn commit(self)

Flushes the pending diagnostics to the underlying Emitter

Trait Implementations§

Source§

impl Emitter for BatchEmitter<'_>

Source§

fn emit(&self, level: Level, diag: Diagnostic)

Emit a diagnostic.

Note that diagnostics and notes are relayed to the underlying Emitter only after a call to BatchEmitter::commit.

Source§

fn note(&self, kind: NoteKind, note: Diagnostic)

Emit a note.

Note that diagnostics and notes are relayed to the underlying Emitter only after a call to BatchEmitter::commit.

Auto Trait Implementations§

§

impl<'e> !Freeze for BatchEmitter<'e>

§

impl<'e> !RefUnwindSafe for BatchEmitter<'e>

§

impl<'e> !Send for BatchEmitter<'e>

§

impl<'e> !Sync for BatchEmitter<'e>

§

impl<'e> !UnwindSafe for BatchEmitter<'e>

§

impl<'e> Unpin for BatchEmitter<'e>

§

impl<'e> UnsafeUnpin for BatchEmitter<'e>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.