Skip to main content

StackError

Trait StackError 

Source
pub trait StackError:
    Display
    + Debug
    + Send
    + Sync {
    // Required methods
    fn as_std(&self) -> &(dyn Error + Send + Sync + 'static);
    fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>;
    fn as_dyn(&self) -> &dyn StackError;
    fn meta(&self) -> Option<&Meta>;
    fn source(&self) -> Option<ErrorRef<'_>>;
    fn fmt_message(&self, f: &mut Formatter<'_>) -> Result;
    fn is_transparent(&self) -> bool;

    // Provided methods
    fn as_ref(&self) -> ErrorRef<'_> { ... }
    fn stack(&self) -> Chain<'_>  { ... }
    fn sources(&self) -> Chain<'_>  { ... }
    fn report(&self) -> Report<'_> { ... }
}
Expand description

Trait implemented by errors produced by this crate.

It extends std::error::Error semantics with optional error metadata, and a source method where sources may also provide metadata.

Required Methods§

Source

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Returns this error as a std error reference.

Source

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Returns this error as a std error.

Source

fn as_dyn(&self) -> &dyn StackError

Returns this error as a dyn StackError.

Source

fn meta(&self) -> Option<&Meta>

Returns metadata captured at creation time, if available.

Source

fn source(&self) -> Option<ErrorRef<'_>>

Returns the next source in the chain, if any.

Source

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

Returns the next source in the chain, if any.

Source

fn is_transparent(&self) -> bool

Returns whether this error is transparent and should be skipped in reports.

Provided Methods§

Source

fn as_ref(&self) -> ErrorRef<'_>

Returns this error as an ErrorRef.

See ErrorRef for details.

Source

fn stack(&self) -> Chain<'_>

Returns an iterator over this error followed by its sources.

Source

fn sources(&self) -> Chain<'_>

Returns an iterator over sources of this error (skipping self).

Source

fn report(&self) -> Report<'_>

Returns a Report to output the error with configurable formatting.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StackError for AddrParseError

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl StackError for Error

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl StackError for Error

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl StackError for FromUtf8Error

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl StackError for TryFromSliceError

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl StackError for Utf8Error

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Source§

impl<T: StackError + Error + Sized + 'static> StackError for Arc<T>

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Source§

fn as_dyn(&self) -> &dyn StackError

Source§

fn meta(&self) -> Option<&Meta>

Source§

fn source(&self) -> Option<ErrorRef<'_>>

Source§

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

Source§

fn is_transparent(&self) -> bool

Implementors§