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I4MODB6UYA3ONQQC
BZSTVYDVHJA3ZMCM3YTU4U5JKJC2JVUDM5APSBIGMSS54J2C4WKQC
WJWASFHAXBNMWHEXMKR53FLXPVUFVT44F2WKSJSA57V2UOZVSOJQC
customize its behavior. Below is a list of known custom context crates and
short summaries of what features they provide.
customize its behavior. Below is a list of known crates that export report
handlers for eyre and short summaries of what features they provide.
- [`jane-eyre`]: A custom context type that exists purely for the pun.
Currently just re-exports `color-eyre`.
- [`jane-eyre`]: A a report handler crate that exists purely for the pun.
Currently just re-exports `color-eyre`.
[actions-badge]: https://github.com/yaahc/eyre/workflows/Continuous%20integration/badge.svg
[actions-url]: https://github.com/yaahc/eyre/actions?query=workflow%3A%22Continuous+integration%22
impl<T, E, C: EyreContext> Sealed<C> for Result<T, E> where E: ext::StdError<C> {}
impl<T, C: EyreContext> Sealed<C> for Option<T> {}
impl<T, E, H: EyreHandler> Sealed<H> for Result<T, E> where E: ext::StdError<H> {}
impl<T, H: EyreHandler> Sealed<H> for Option<T> {}
object_mut: object_mut::<E, C>,
object_boxed: object_boxed::<E, C>,
object_downcast: object_downcast::<E, C>,
object_drop_rest: object_drop_front::<E, C>,
object_mut: object_mut::<E, H>,
object_boxed: object_boxed::<E, H>,
object_downcast: object_downcast::<E, H>,
object_drop_rest: object_drop_front::<E, H>,
object_mut: object_mut::<MessageError<M>, C>,
object_boxed: object_boxed::<MessageError<M>, C>,
object_downcast: object_downcast::<M, C>,
object_drop_rest: object_drop_front::<M, C>,
object_mut: object_mut::<MessageError<M>, H>,
object_boxed: object_boxed::<MessageError<M>, H>,
object_downcast: object_downcast::<M, H>,
object_drop_rest: object_drop_front::<M, H>,
object_mut: object_mut::<DisplayError<M>, C>,
object_boxed: object_boxed::<DisplayError<M>, C>,
object_downcast: object_downcast::<M, C>,
object_drop_rest: object_drop_front::<M, C>,
object_mut: object_mut::<DisplayError<M>, H>,
object_boxed: object_boxed::<DisplayError<M>, H>,
object_downcast: object_downcast::<M, H>,
object_drop_rest: object_drop_front::<M, H>,
let context = Some(C::default(&NoneError));
unsafe { Report::construct(error, vtable, context) }
let handler = Some(H::default(&NoneError));
unsafe { Report::construct(error, vtable, handler) }
object_mut: object_mut::<ContextError<D, E>, C>,
object_boxed: object_boxed::<ContextError<D, E>, C>,
object_downcast: context_downcast::<D, E, C>,
object_drop_rest: context_drop_rest::<D, E, C>,
object_mut: object_mut::<ContextError<D, E>, H>,
object_boxed: object_boxed::<ContextError<D, E>, H>,
object_downcast: context_downcast::<D, E, H>,
object_drop_rest: context_drop_rest::<D, E, H>,
object_mut: object_mut::<BoxedError, C>,
object_boxed: object_boxed::<BoxedError, C>,
object_downcast: object_downcast::<Box<dyn StdError + Send + Sync>, C>,
object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>, C>,
object_mut: object_mut::<BoxedError, H>,
object_boxed: object_boxed::<BoxedError, H>,
object_downcast: object_downcast::<Box<dyn StdError + Send + Sync>, H>,
object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>, H>,
let context = self.inner.context.take();
let error: ContextError<D, Report<C>> = ContextError { msg, error: self };
let handler = self.inner.handler.take();
let error: ContextError<D, Report<H>> = ContextError { msg, error: self };
object_mut: object_mut::<ContextError<D, Report<C>>, C>,
object_boxed: object_boxed::<ContextError<D, Report<C>>, C>,
object_downcast: context_chain_downcast::<D, C>,
object_drop_rest: context_chain_drop_rest::<D, C>,
object_mut: object_mut::<ContextError<D, Report<H>>, H>,
object_boxed: object_boxed::<ContextError<D, Report<H>>, H>,
object_downcast: context_chain_downcast::<D, H>,
object_drop_rest: context_chain_drop_rest::<D, H>,
/// Get a reference to the Context for this Report.
pub fn context(&self) -> &C {
self.inner.context.as_ref().unwrap()
/// Get a reference to the Handler for this Report.
pub fn handler(&self) -> &H {
self.inner.handler.as_ref().unwrap()
/// Get a mutable reference to the Context for this Report.
pub fn context_mut(&mut self) -> &mut C {
self.inner.context.as_mut().unwrap()
/// Get a mutable reference to the Handler for this Report.
pub fn handler_mut(&mut self) -> &mut H {
self.inner.handler.as_mut().unwrap()
}
/// Get a reference to the Handler for this Report.
#[doc(hidden)]
pub fn context(&self) -> &H {
self.inner.handler.as_ref().unwrap()
object_drop: unsafe fn(Box<ErrorImpl<(), C>>),
object_ref: unsafe fn(&ErrorImpl<(), C>) -> &(dyn StdError + Send + Sync + 'static),
object_drop: unsafe fn(Box<ErrorImpl<(), H>>),
object_ref: unsafe fn(&ErrorImpl<(), H>) -> &(dyn StdError + Send + Sync + 'static),
object_boxed: unsafe fn(Box<ErrorImpl<(), C>>) -> Box<dyn StdError + Send + Sync + 'static>,
object_downcast: unsafe fn(&ErrorImpl<(), C>, TypeId) -> Option<NonNull<()>>,
object_drop_rest: unsafe fn(Box<ErrorImpl<(), C>>, TypeId),
object_boxed: unsafe fn(Box<ErrorImpl<(), H>>) -> Box<dyn StdError + Send + Sync + 'static>,
object_downcast: unsafe fn(&ErrorImpl<(), H>, TypeId) -> Option<NonNull<()>>,
object_drop_rest: unsafe fn(Box<ErrorImpl<(), H>>, TypeId),
//! This library provides [`eyre::Report`][Report], a trait object based error
//! type for easy idiomatic error handling in Rust applications.
//! This library provides [`eyre::Report`][Report], a trait object based
//! error handling type for easy idiomatic error handling and reporting in Rust
//! applications.
//! customize its behavior. Below is a list of known custom context crates and
//! short summaries of what features they provide.
//! customize its behavior. Below is a list of known crates that export report
//! handlers for eyre and short summaries of what features they provide.
//! - [`jane-eyre`]: A custom context type that exists purely for the pun.
//! Currently just re-exports `color-eyre`.
//! - [`jane-eyre`]: A a report handler crate that exists purely for the pun.
//! Currently just re-exports `color-eyre`.
//! - Use `Result<T, eyre::Report>`, or equivalently `eyre::Result<T>`, as
//! the return type of any fallible function.
//! - Use `Result<T, eyre::Report>`, or equivalently `eyre::Result<T>`, as the
//! return type of any fallible function.
//! Within the function, use `?` to easily propagate any error that implements
//! the `std::error::Report` trait.
//! Within the function, use `?` to easily propagate any error that implements the
//! `std::error::Error` trait.
//! - Create new errors from messages to help the person troubleshooting the error understand where
//! things went wrong. A low-level error like "No such file or directory" can be annoying to
//! directly and often benefit from being wrapped with higher level error messages.
//! - Wrap a lower level error with a new error created from a message to help the
//! person troubleshooting understand what the chain of failures that occured. A
//! low-level error like "No such file or directory" can be annoying to debug
//! without more information about what higher level step the application was in
//! the middle of.
//! error if the underlying error type does not already provide its own. In
//! order to see backtraces, they must be enabled through the environment
//! variables described in [`std::backtrace`]:
//! error if the underlying error type does not already provide its own. In order
//! to see backtraces, they must be enabled through the environment variables
//! described in [`std::backtrace`]:
//! including ones defined in your crate. We do not bundle a `derive(Error)`
//! macro but you can write the impls yourself or use a standalone macro like
//! including ones defined in your crate. We do not bundle a `derive(Error)` macro
//! but you can write the impls yourself or use a standalone macro like
//! In no_std mode, the same API is almost all available and works the same way.
//! To depend on Eyre in no_std mode, disable our default enabled "std"
//! feature in Cargo.toml. A global allocator is required.
//! **NOTE**: tests are currently broken for `no_std` so I cannot guarantee that
//! everything works still. I'm waiting for upstream fixes to be merged rather than
//! fixing them myself, so bear with me.
//!
//! In no_std mode, the same API is almost all available and works the same way. To
//! depend on Eyre in no_std mode, disable our default enabled "std" feature in
//! Cargo.toml. A global allocator is required.
//! `std::error::Report` trait which is only available through std, no_std mode
//! will require an explicit `.map_err(Report::msg)` when working with a
//! non-Eyre error type inside a function that returns Eyre's error type.
//! `std::error::Error` trait which is only available through std, no_std mode will
//! require an explicit `.map_err(Report::msg)` when working with a non-Eyre error
//! type inside a function that returns Eyre's error type.
//!
//! ## Comparison to failure
//!
//! The `eyre::Report` type works something like `failure::Error`, but unlike
//! failure ours is built around the standard library's `std::error::Error` trait
//! rather than a separate trait `failure::Fail`. The standard library has adopted
//! the necessary improvements for this to be possible as part of [RFC 2504].
//!
//! [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
//!
//! ## Comparison to thiserror
//!
//! Use Eyre if you don't care what error type your functions return, you just
//! want it to be easy. This is common in application code. Use [thiserror] if you
//! are a library that wants to design your own dedicated error type(s) so that on
//! failures the caller gets exactly the information that you choose.
//!
//! [thiserror]: https://github.com/dtolnay/thiserror
/// In order to insert your own custom context type you must first implement the
/// `eyre::EyreContext` trait.
/// In order to insert your own custom context and report format you must first
/// implement the `eyre::EyreHandler` trait.
pub trait EyreContext: Sized + Send + Sync + 'static {
/// Default construct a `Context` when constructing a `Report`.
pub trait EyreHandler: Sized + Send + Sync + 'static {
/// Default construct a `Handler` when constructing a `Report`.