Function alternatively_with_error

Source
pub fn alternatively_with_error<T, E1, E2>(
    f1: impl FnOnce() -> Result<T, E1>,
    f2: impl FnOnce(E1) -> Result<T, E2>,
) -> Result<T, E2>
Expand description

Try two approaches to generate T, if both fail, return the error of the second attempt (but f2 could embed the error of the first attempt in that).