core-error

std::error::Error in no_std environment.

Latest version: 0.0.0 registry icon
Maintenance score
0
Safety score
0
Popularity score
73
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.0.0 0 0 0 0 0

Stability
Latest release:

0.0.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



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).