wee_woo

Struct ErrorWithSource

source
pub struct ErrorWithSource<This, Source> {
    pub this: This,
    pub source: Source,
}
Expand description

An Error with a source Error.

This is useful for constructing ad-hoc chains of errors.

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: Debug, Source: Debug> Debug for ErrorWithSource<This, Source>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<This, Source> Display for ErrorWithSource<This, Source>
where This: Display,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<This, Source> Error for ErrorWithSource<This, Source>
where This: Display + Debug, Source: Error + 'static,

source§

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>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl<This, Source> Freeze for ErrorWithSource<This, Source>
where This: Freeze, Source: Freeze,

§

impl<This, Source> RefUnwindSafe for ErrorWithSource<This, Source>
where This: RefUnwindSafe, Source: RefUnwindSafe,

§

impl<This, Source> Send for ErrorWithSource<This, Source>
where This: Send, Source: Send,

§

impl<This, Source> Sync for ErrorWithSource<This, Source>
where This: Sync, Source: Sync,

§

impl<This, Source> Unpin for ErrorWithSource<This, Source>
where This: Unpin, Source: Unpin,

§

impl<This, Source> UnwindSafe for ErrorWithSource<This, Source>
where This: UnwindSafe, Source: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<This> ErrorExt for This
where This: Error,

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>

Set self as the source of the given error. Read more
source§

fn display_with_sources<I>(&self, infix: I) -> DisplayWithSources<&This, I>

Display an Error and its sources with a separator.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.