5 releases

Uses old Rust 2015

0.0.1-rc4 Mar 15, 2020
0.0.1-rc3 Nov 22, 2019
0.0.1-rc2 Oct 27, 2019
0.0.0 Oct 8, 2019

#72 in No standard library

Download history 2479/week @ 2023-11-18 2477/week @ 2023-11-25 1947/week @ 2023-12-02 2306/week @ 2023-12-09 2428/week @ 2023-12-16 1290/week @ 2023-12-23 1626/week @ 2023-12-30 2442/week @ 2024-01-06 1951/week @ 2024-01-13 2227/week @ 2024-01-20 2505/week @ 2024-01-27 3199/week @ 2024-02-03 3058/week @ 2024-02-10 2402/week @ 2024-02-17 2333/week @ 2024-02-24 1848/week @ 2024-03-02

10,070 downloads per month
Used in 34 crates (13 directly)

MIT/Apache

14KB
188 lines

Core Error

Traits for working with Error in std-less environments.

Warning

This is a pre-release meant to allow experimentation and integration into the various error handling crates. Please do not use it yet! 1.0.0 is right around the corner.

Rationale

With the recent proliferation of error-handling crates, it has become clear that the situation around the lack of a core::error::Error is really suboptimal. In snafu, no_std support is being introduced through a whole new Error trait just for no_std - which could lead to similar problems that failure had by becoming incompatible with the ecosystem.

Ideally, the Error trait would show up in core, but due to coherence concerns and std-dependent features being added to std::error::Error, a resolution is unlikely to happen soon. As such, I propose making a new crate, core-error - exposing our own version of the Error trait. The goal of this crate is twofolds:

  • Provide a common trait for various error handling crates (Failure, Snafu, Fehler, Anyhow, error_chain, and any others?)
  • Allow no_std libraries that don't want to depend on a specific error handling crate to still expose errors that can interoperate with those libraries.

This crate is still in the early stages. Once it reaches 1.0.0, it will be ready for integration in the various error crates. Furthermore, once it reaches 1.0.0, it will follow the same stability guarantees Rust does.

Usage

This crate simply provides an Error trait, which is identical to the one in std except for not providing deprecated methods. It also contains two features:

  • std: simply reexport std::error::Error
  • alloc: implement Error on alloc Errors (incl. Box)

Libraries using this crate should forward their equivalent features to this library.

Minimum Rust Version

This crate works all the way down to 1.0.0. It auto-detects the Rust version in order to know which error structs to implement the trait on.

With no-default-features, the crate only compiles from 1.13.0 onwards (See #11 for the reason why this release is the minimum suported version).

No runtime deps