pub struct Error { /* private fields */ }Expand description
A parse or validation error with span information and a user-facing suggestion.
Convert to a compiler diagnostic with Error::to_compile_error.
Implementations§
Source§impl Error
impl Error
pub fn missing_wrapper(span: Span, expected: &'static str, found: &Type) -> Self
pub fn empty_generic_args(span: Span, wrapper: &'static str) -> Self
pub fn unsupported_type( span: Span, ty: &Type, reason: &'static str, suggestion: &'static str, ) -> Self
pub fn invalid_attr_value( span: Span, attr: &str, expected: &'static str, found: &str, ) -> Self
pub fn missing_required_attr( span: Span, attr: &'static str, context: &'static str, ) -> Self
pub fn conflicting_attrs(span: Span, first: &str, second: &str) -> Self
pub fn missing_return_type(span: Span, fn_name: &str) -> Self
pub fn invalid_handler_sig( span: Span, fn_name: &str, reason: &'static str, ) -> Self
pub fn unknown_key( span: Span, key: &str, valid_keys: &'static [&'static str], ) -> Self
Sourcepub fn to_compile_error(&self) -> TokenStream
pub fn to_compile_error(&self) -> TokenStream
Emit a compile_error! token stream pointing at the offending span.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !Send for Error
impl !Sync for Error
impl Freeze for Error
impl RefUnwindSafe for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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