Struct error_stack::Frame

source ·
pub struct Frame { /* private fields */ }
Expand description

A single context or attachment inside of a Report.

Frames are organized as a singly linked list, which can be iterated by calling Report::frames(). The head contains the current context or attachment, and the tail contains the root context created by Report::new(). The next Frame can be accessed by requesting it by calling Report::request_ref().

Implementations§

source§

impl Frame

source

pub const fn sources(&self) -> &[Self]

Returns a shared reference to the source of this Frame.

This corresponds to the Frame below this one in a Report.

source

pub fn sources_mut(&mut self) -> &mut [Self]

Returns a mutable reference to the sources of this Frame.

This corresponds to the Frame below this one in a Report.

source

pub fn kind(&self) -> FrameKind<'_>

Returns how the Frame was created.

source

pub fn is<T: Send + Sync + 'static>(&self) -> bool

Returns if T is the held context or attachment by this frame.

source

pub fn downcast_ref<T: Send + Sync + 'static>(&self) -> Option<&T>

Downcasts this frame if the held context or attachment is the same as T.

source

pub fn downcast_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T>

Downcasts this frame if the held context or attachment is the same as T.

source

pub fn type_id(&self) -> TypeId

Returns the TypeId of the held context or attachment by this frame.

Trait Implementations§

source§

impl Debug for Frame

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl !RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl !UnwindSafe for Frame

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

§

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

§

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.