Expand description

A crate that allows declaring an equality bound on two types and coercing between them.

Examples

pub trait ResultExt<T, E>: Sized + Is<Result<T, E>> {
    /// Given any `E` and `EI` that implement `Into<ER>`, converts from Result<Result<T, EI>, E> to Result<T, ER>.
    fn flatten_into<TI, EI, ER>(self) -> Result<TI, ER>
    where
        T: Is<Result<TI, EI>>,
        E: Into<ER>,
        EI: Into<ER>,
    {
        self.coerce().map_err(|e| e.into()).and_then(|x| x.coerce().map_err(|e| e.into()))
    }
}

Traits