pub struct ErrorWithSource<This, Source> {
pub this: This,
pub source: Source,
}
Expand description
Fields§
§this: This
The current error.
Note that calling Error::source
on an ErrorWithSource
will not
call Error::source
on this
; source
will always be returned
instead.
source: Source
The error that caused the current error.
This value will be returned by ErrorWithSource
’s Error::source
and Error::cause
implementations. Note that the latter is
deprecated.
Trait Implementations§
source§impl<This, Source> Display for ErrorWithSource<This, Source>where
This: Display,
impl<This, Source> Display for ErrorWithSource<This, Source>where
This: Display,
source§impl<This, Source> Error for ErrorWithSource<This, Source>
impl<This, Source> Error for ErrorWithSource<This, Source>
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
source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
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<This, Source> Freeze for ErrorWithSource<This, Source>
impl<This, Source> RefUnwindSafe for ErrorWithSource<This, Source>where
This: RefUnwindSafe,
Source: RefUnwindSafe,
impl<This, Source> Send for ErrorWithSource<This, Source>
impl<This, Source> Sync for ErrorWithSource<This, Source>
impl<This, Source> Unpin for ErrorWithSource<This, Source>
impl<This, Source> UnwindSafe for ErrorWithSource<This, Source>where
This: UnwindSafe,
Source: 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
source§impl<This> ErrorExt for Thiswhere
This: Error,
impl<This> ErrorExt for Thiswhere
This: Error,
source§fn with_source<Source>(self, source: Source) -> ErrorWithSource<This, Source>
fn with_source<Source>(self, source: Source) -> ErrorWithSource<This, Source>
Attach a source to the current error. Read more
source§fn caused<Error>(self, error: Error) -> ErrorWithSource<Error, This>
fn caused<Error>(self, error: Error) -> ErrorWithSource<Error, This>
Set
self
as the source of the given error. Read more