Skip to main content

Cause

Struct Cause 

Source
pub struct Cause {
    pub error: CapturedError,
    pub attachments: ThinVec<CapturedAttachment>,
}
Expand description

A link in a Problem’s causation chain.

Fields§

§error: CapturedError

Error.

§attachments: ThinVec<CapturedAttachment>

Attachments.

Implementations§

Source§

impl Cause

Source

pub fn new(error: CapturedError) -> Self

Constructor.

Source

pub fn to_ref<'problem>( &'problem self, problem: &'problem Problem, depth: usize, ) -> CauseRef<'problem, CapturedError>

To a CauseRef.

Trait Implementations§

Source§

impl Attachments for Cause

Source§

fn attachments(&self) -> impl Iterator<Item = &CapturedAttachment>

Iterate attachments.
Source§

fn attachments_of_type<'this, AttachmentT>( &'this self, ) -> impl Iterator<Item = &'this AttachmentT>
where AttachmentT: 'static,

Iterate attachments of a type.
Source§

fn attachment_of_type<AttachmentT>(&self) -> Option<&AttachmentT>
where AttachmentT: 'static,

First attachment of a type.
Source§

impl AttachmentsMut for Cause

Source§

fn attachments_mut(&mut self) -> impl Iterator<Item = &mut CapturedAttachment>

Iterate attachments.
Source§

fn attach<AttachmentT>(&mut self, attachment: AttachmentT)
where AttachmentT: 'static + Send + Sync,

Add an attachment.
Source§

fn attachments_of_type_mut<'this, AttachmentT>( &'this mut self, ) -> impl Iterator<Item = &'this mut AttachmentT>
where AttachmentT: 'static,

Iterate attachments of a type.
Source§

fn attachment_of_type_mut<AttachmentT>(&mut self) -> Option<&mut AttachmentT>
where AttachmentT: 'static,

First attachment of a type.
Source§

fn must_attachment_of_type_mut<AttachmentT, DefaultT>( &mut self, default: DefaultT, ) -> &mut AttachmentT
where AttachmentT: 'static + Send + Sync, DefaultT: FnOnce() -> AttachmentT,

First attachment of a type. Read more
Source§

fn attach_once<AttachmentT>(&mut self, attachment: AttachmentT)
where AttachmentT: 'static + Send + Sync,

Add an attachment only if we don’t already have one of its type.
Source§

fn attach_location_once(&mut self)

Add a Location (via Location::caller) attachment if we don’t already have one.
Source§

fn attach_backtrace_once(&mut self)

Available on crate feature backtrace-external only.
Add a backtrace attachment if we don’t already have one.
Source§

impl Debug for Cause

Source§

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

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

impl Errors for Cause

Source§

fn iter_errors_of_type<'this, ErrorT>( &'this self, ) -> impl Iterator<Item = &'this ErrorT>
where ErrorT: 'static + Error,

Iterate errors of a type.
Source§

fn error_of_type<ErrorT>(&self) -> Option<&ErrorT>
where ErrorT: 'static + Error,

The first error of a type.
Source§

fn has_error_of_type<ErrorT>(&self) -> bool
where ErrorT: 'static + Error,

Whether we have an error of a type.
Source§

fn error_for<ErrorT>(&self, error: &ErrorT) -> Option<&ErrorT>
where ErrorT: 'static + Error + PartialEq,

The first occurrence of an error.
Source§

fn has_error<ErrorT>(&self, error: &ErrorT) -> bool
where ErrorT: 'static + Error + PartialEq,

Whether we have an error.
Source§

impl<ErrorT> From<ErrorT> for Cause
where ErrorT: 'static + Error + Send + Sync,

Source§

fn from(error: ErrorT) -> Self

Converts to this type from the input type.
Source§

impl<'this> IntoIterator for &'this Cause

Source§

type Item = &'this (dyn Error + 'static)

The type of the elements being iterated over.
Source§

type IntoIter = ErrorSourceIterator<'this>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IterateErrorSources for Cause

Source§

fn iter_sources<'this>(&'this self) -> ErrorSourceIterator<'this>

Iterate the Error::source chain.
Source§

impl PartialEq for Cause

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Cause

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Cause

Auto Trait Implementations§

§

impl Freeze for Cause

§

impl !RefUnwindSafe for Cause

§

impl Send for Cause

§

impl Sync for Cause

§

impl Unpin for Cause

§

impl !UnwindSafe for Cause

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<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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.