I have made a crate that does this: Unwrap Infallible Results With All Convenience And No Fear
There is no separate trait to implement for infallible types and a blanket extension impl for Result
as in @Yandros's design. I don't expect there to be many custom never-types that are not just reexports of std::convert::Infallible
. But I have added a feature-gated blanket impl for Result<T, E> where E: From<!>
. This could be morphed into an inherent generic method of standard Result
, if From<!>
becomes a conventional impl to tag types with never occurring values.