Skip to main content

Crate other_error

Crate other_error 

Source
Expand description

§other-error

Lightweight no-std compatible wrapper types for sharing (via Arc or Rc) and combining errors.

§Usage

use other_error::{ArcError, EitherError};
use either::Either;

// Make a non-Clone error cheaply cloneable and shareable.
let err = ArcError::new(std::io::Error::other("boom"));
let also_err = err.clone(); // shares the same allocation

// Represent a value that may fail in one of two ways.
let either: EitherError<std::io::Error, std::fmt::Error> =
    Either::Left(std::io::Error::other("boom")).into();
println!("{either}");

§MSRV

The minimum supported rust version is 1.81, which can be changed in the future. There is no guarantee that this library will work on older versions of rust.

§License

Licensed under either of

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Structs§

ArcError
Error that is sharable between threads
EitherError
Error that is one of two possible error types.
RcError
Reference-counted error for sharing within a single thread.