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>
impl<'e> BatchEmitter<'e>
Sourcepub fn new(emitter: &'e dyn Emitter) -> BatchEmitter<'e>
pub fn new(emitter: &'e dyn Emitter) -> BatchEmitter<'e>
Constructs a new BatchEmitter relaying to the provided Emitter instance.
Trait Implementations§
Source§impl Emitter for BatchEmitter<'_>
impl Emitter for BatchEmitter<'_>
Source§fn emit(&self, level: Level, diag: Diagnostic)
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)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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