ex/lib.rs
1//! A `libstd` wrapper with more detailed errors. This crate mirrors the `std`
2//! module tree, replacing failable functions and structs with wrappers that add
3//! additional information to the errors returned. *WIP, so not all of `libstd`
4//! may be covered*.
5//!
6//! To use `ex`, simply replace a `use std::x` with `use ex::x` for any `x`.
7//! Some structs are different from `libstd`'s, so there might exist some
8//! friction with external crates. In that case, see the `Wrapper` trait on how
9//! to get the wrapped structs.
10//!
11//! `ex` also uses custom error types to transport the augmented error messages.
12//! In all cases, you can use `err.cause()` to get a reference to the original
13//! error, or the `Wrapper` trait.
14
15pub mod fs;
16pub mod io;
17
18use std::ops::{Deref, DerefMut};
19
20pub trait Wrapper<T>: Deref<Target = T> + DerefMut<Target = T> {
21 fn into_inner(self) -> T;
22}