Struct proc_macro_error::single::MacroError
source · pub struct MacroError { /* private fields */ }
Expand description
An single error message in a proc macro with span info attached.
Implementations§
source§impl MacroError
impl MacroError
sourcepub fn new(span: Span, msg: String) -> Self
pub fn new(span: Span, msg: String) -> Self
Create an error with the span and message provided.
sourcepub fn call_site(msg: String) -> Self
pub fn call_site(msg: String) -> Self
A shortcut for MacroError::new(Span::call_site(), message)
sourcepub fn set_message(&mut self, msg: String) -> String
pub fn set_message(&mut self, msg: String) -> String
Replace the error message with msg
. Returns old message.
Trait Implementations§
source§impl AsMut<String> for MacroError
impl AsMut<String> for MacroError
source§impl AsRef<String> for MacroError
impl AsRef<String> for MacroError
source§impl Debug for MacroError
impl Debug for MacroError
source§impl Display for MacroError
impl Display for MacroError
source§impl From<&str> for MacroError
impl From<&str> for MacroError
source§impl From<Error> for MacroError
impl From<Error> for MacroError
source§impl From<String> for MacroError
impl From<String> for MacroError
source§impl ToTokens for MacroError
impl ToTokens for MacroError
source§fn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for MacroError
impl RefUnwindSafe for MacroError
impl !Send for MacroError
impl !Sync for MacroError
impl Unpin for MacroError
impl UnwindSafe for MacroError
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
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.