pub enum ErrorRef<'a> {
Std(&'a (dyn Error + 'static), Option<&'a Meta>),
Stack(&'a dyn StackError),
}Expand description
Reference to an error which can either be a std error or a stack error.
This provides a unified interface to either a std or a stack error. If it’s a stack error it allows to access the error metadata captured at the call site.
Variants§
Std(&'a (dyn Error + 'static), Option<&'a Meta>)
Std error (no location info).
Stack(&'a dyn StackError)
StackError (has location info).
Implementations§
Source§impl<'a> ErrorRef<'a>
impl<'a> ErrorRef<'a>
Sourcepub fn stack(err: &dyn StackError) -> ErrorRef<'_>
pub fn stack(err: &dyn StackError) -> ErrorRef<'_>
Creates a ErrorRef for a StackError.
Sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Returns true if this error is transparent (i.e. directly forwards to its source).
Sourcepub fn source(self) -> Option<ErrorRef<'a>>
pub fn source(self) -> Option<ErrorRef<'a>>
Returns the next source in the source chain as a ErrorRef.
Sourcepub fn meta(&self) -> Option<&Meta>
pub fn meta(&self) -> Option<&Meta>
Returns the location where this error was created, if available.
Sourcepub fn fmt_message(&self, f: &mut Formatter<'_>) -> Result
pub fn fmt_message(&self, f: &mut Formatter<'_>) -> Result
Formats the error message.
Sourcepub fn downcast_ref<T: Error + 'static>(self) -> Option<&'a T>
pub fn downcast_ref<T: Error + 'static>(self) -> Option<&'a T>
Downcast this error object by reference.
Trait Implementations§
impl<'a> Copy for ErrorRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for ErrorRef<'a>
impl<'a> !RefUnwindSafe for ErrorRef<'a>
impl<'a> !Send for ErrorRef<'a>
impl<'a> !Sync for ErrorRef<'a>
impl<'a> Unpin for ErrorRef<'a>
impl<'a> !UnwindSafe for ErrorRef<'a>
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