std_ext/result.rs
1use std::convert::Infallible;
2
3pub trait UnwrapInfallible {
4 type Ok;
5 fn unwrap_infallible(self) -> Self::Ok;
6}
7
8impl<T> UnwrapInfallible for Result<T, Infallible> {
9 type Ok = T;
10 fn unwrap_infallible(self) -> T {
11 match self {
12 Ok(val) => val,
13 Err(never) => match never {},
14 }
15 }
16}