[][src]Struct proc_macro_error::MultiMacroErrors

pub struct MultiMacroErrors(_);

This type represents a container for multiple errors. Each error has it's own span location.

Methods

impl MultiMacroErrors[src]

pub fn new() -> Self[src]

Create an empty errors storage.

pub fn is_empty(&self) -> bool[src]

Test if the storage contains no errors.

pub fn add(&mut self, err: MacroError)[src]

Add an error to the list of errors.

pub fn add_span_msg(&mut self, span: Span, msg: String)[src]

Shortcut for .add(MacroError::new(span, msg))

pub fn into_compile_errors(self) -> TokenStream[src]

Convert this storage into TokenStream consisting of compile_error!(msg1); compile_error!(msg2);... sequence. Each compile_error! invocation gets the span attached to the particular message.

pub fn trigger(self) -> ![src]

Abort the proc-macro's execution and display the errors contained.

Note:

This function aborts even no errors are present! It's very much possibly that trigger_on_error is what you really want.

pub fn trigger_on_error(self)[src]

If this storage is not empty abort the proc-macro's execution and display the errors contained.

Trait Implementations

impl From<MultiMacroErrors> for TokenStream[src]

impl From<MultiMacroErrors> for TokenStream[src]

impl IntoIterator for MultiMacroErrors[src]

type Item = MacroError

The type of the elements being iterated over.

type IntoIter = <Vec<MacroError> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?

impl Deref for MultiMacroErrors[src]

type Target = [MacroError]

The resulting type after dereferencing.

impl DerefMut for MultiMacroErrors[src]

impl FromIterator<MacroError> for MultiMacroErrors[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]