pub struct Error<S> { /* private fields */ }Expand description
An error.
Implementations§
source§impl<S: SpanExt> Error<S>
impl<S: SpanExt> Error<S>
sourcepub fn new(message: impl Into<Cow<'static, str>>) -> Self
pub fn new(message: impl Into<Cow<'static, str>>) -> Self
Create a new error with the provided message.
sourcepub fn with_span(span: S, message: impl Into<Cow<'static, str>>) -> Self
pub fn with_span(span: S, message: impl Into<Cow<'static, str>>) -> Self
Create a new error with the provided message and span.
sourcepub fn set_message(&mut self, message: impl Into<Cow<'static, str>>)
pub fn set_message(&mut self, message: impl Into<Cow<'static, str>>)
Set a new error message for this error, keeping the span.
sourcepub fn to_compile_error(&self) -> S::TokenStream
pub fn to_compile_error(&self) -> S::TokenStream
Convert this error into a TokenStream that will trigger a compile error
at the error’s span.
Trait Implementations§
source§impl<S: Debug> Error for Error<S>
impl<S: Debug> Error for Error<S>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<S> RefUnwindSafe for Error<S>where
S: RefUnwindSafe,
impl<S> Send for Error<S>where
S: Send,
impl<S> Sync for Error<S>where
S: Sync,
impl<S> Unpin for Error<S>where
S: Unpin,
impl<S> UnwindSafe for Error<S>where
S: UnwindSafe,
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