Skip to main content

CauseRef

Struct CauseRef 

Source
pub struct CauseRef<'problem, ErrorT> {
    pub problem: &'problem Problem,
    pub depth: usize,
    pub error: &'problem ErrorT,
    pub attachments: &'problem ThinVec<CapturedAttachment>,
}
Expand description

Reference to a Cause.

Fields§

§problem: &'problem Problem

Containing problem.

§depth: usize

Depth in causation chain.

§error: &'problem ErrorT

Error.

This error could be either on the causation chain or nested in source.

§attachments: &'problem ThinVec<CapturedAttachment>

Attachments.

Implementations§

Source§

impl<'problem, ErrorT> CauseRef<'problem, ErrorT>

Source

pub fn new( problem: &'problem Problem, depth: usize, error: &'problem ErrorT, attachments: &'problem ThinVec<CapturedAttachment>, ) -> Self

Constructor.

Source

pub fn cause(&self) -> &'problem Cause

The cause.

Source

pub fn iter_under(&self) -> CauseRefIterator<'problem>

Iterate the causation chain starting from under this cause ending at the root.

Note that this will skip over source.

Source

pub fn under(&self) -> Option<CauseRef<'problem, CapturedError>>

The cause under this one in the causation chain.

It will be None if we are the root cause.

Note that this will skip over source.

Source

pub fn is_top(&self) -> bool

Whether we are the top cause of the chain.

Source

pub fn is_root(&self) -> bool

Whether we are the root cause of the chain.

Trait Implementations§

Source§

impl<'problem, ErrorT> Attachments for CauseRef<'problem, ErrorT>

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.

Auto Trait Implementations§

§

impl<'problem, ErrorT> Freeze for CauseRef<'problem, ErrorT>

§

impl<'problem, ErrorT> !RefUnwindSafe for CauseRef<'problem, ErrorT>

§

impl<'problem, ErrorT> Send for CauseRef<'problem, ErrorT>
where ErrorT: Sync,

§

impl<'problem, ErrorT> Sync for CauseRef<'problem, ErrorT>
where ErrorT: Sync,

§

impl<'problem, ErrorT> Unpin for CauseRef<'problem, ErrorT>

§

impl<'problem, ErrorT> UnsafeUnpin for CauseRef<'problem, ErrorT>

§

impl<'problem, ErrorT> !UnwindSafe for CauseRef<'problem, ErrorT>

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<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.