pub struct Error(pub ErrorKind, _);Expand description
The Error type.
This tuple struct is made of two elements:
- an
ErrorKindwhich is used to determine the type of the error. - An internal
State, not meant for direct use outside oferror_chaininternals, containing:- a backtrace, generated when the error is created.
- an error chain, used for the implementation of
Error::cause().
Tuple Fields§
§0: ErrorKindThe kind of the error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn from_kind(kind: ErrorKind) -> Error
pub fn from_kind(kind: ErrorKind) -> Error
Constructs an error from a kind, and generates a backtrace.
Sourcepub fn with_chain<E, K>(error: E, kind: K) -> Error
pub fn with_chain<E, K>(error: E, kind: K) -> Error
Constructs a chained error from another error and a kind, and generates a backtrace.
Sourcepub fn with_boxed_chain<K>(error: Box<dyn Error + Send>, kind: K) -> Error
pub fn with_boxed_chain<K>(error: Box<dyn Error + Send>, kind: K) -> Error
Construct a chained error from another boxed error and a kind, and generates a backtrace
Sourcepub fn backtrace(&self) -> Option<&Backtrace>
pub fn backtrace(&self) -> Option<&Backtrace>
Returns the backtrace associated with this error.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
A short description of the error.
This method is identical to Error::description()
Source§impl Error
impl Error
Sourcepub fn dump_uncolorized(&self)
pub fn dump_uncolorized(&self)
Write the information contained in this object to standard error in a somewhat user-friendly form.
The error_chain crate provides a Display impl for its Error objects
that ought to provide this functionality, but I have had enormous
trouble being able to use it. So instead we emulate their code. This
function is also paralleled by the implementation in
status::termcolor::TermcolorStatusBackend, which adds the sugar of
providing nice colorization if possible. This function should only be
used if a StatusBackend is not yet available in the running program.
Trait Implementations§
Source§impl ChainedError for Error
impl ChainedError for Error
Source§fn from_kind(kind: Self::ErrorKind) -> Self
fn from_kind(kind: Self::ErrorKind) -> Self
Source§fn with_chain<E, K>(error: E, kind: K) -> Self
fn with_chain<E, K>(error: E, kind: K) -> Self
Source§fn display_chain<'a>(&'a self) -> DisplayChain<'a, Self>
fn display_chain<'a>(&'a self) -> DisplayChain<'a, Self>
Display for printing the full
context of this error. Read moreSource§impl DefinitelySame for Error
impl DefinitelySame for Error
fn definitely_same(&self, other: &Self) -> bool
Source§impl Error for Error
impl Error for Error
Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Source§impl From<Error> for Error
impl From<Error> for Error
Source§fn from(e: WriteError) -> Self
fn from(e: WriteError) -> Self
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(e: ParseIntError) -> Self
fn from(e: ParseIntError) -> Self
Source§impl From<PersistError> for Error
impl From<PersistError> for Error
Source§fn from(e: PersistError) -> Self
fn from(e: PersistError) -> Self
Source§impl From<SystemTimeError> for Error
impl From<SystemTimeError> for Error
Source§fn from(e: SystemTimeError) -> Self
fn from(e: SystemTimeError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !Sync for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.