pub struct Emitter(/* private fields */);
Expand description
Allows emitting errors without returning.
Implementations§
source§impl Emitter
impl Emitter
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an Emitter
, this can be used to collect errors than can later
be converted with Emitter::into_result()
.
sourcepub fn emit(&mut self, error: impl ToTokensError + 'static)
pub fn emit(&mut self, error: impl ToTokensError + 'static)
Emitts an error
sourcepub fn into_result(&mut self) -> Result<(), Error>
pub fn into_result(&mut self) -> Result<(), Error>
Returns emitted errors if not Self::is_empty
.
If no errors where emitted, returns Ok(())
.
Note: This clears the emitter to avoid returning duplicate errors.
Trait Implementations§
source§impl<I: ToTokensError + 'static> Extend<I> for Emitter
impl<I: ToTokensError + 'static> Extend<I> for Emitter
source§fn extend<T: IntoIterator<Item = I>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = I>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl Freeze for Emitter
impl !RefUnwindSafe for Emitter
impl !Send for Emitter
impl !Sync for Emitter
impl Unpin for Emitter
impl !UnwindSafe for Emitter
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
Mutably borrows from an owned value. Read more