kurtbuilds_std_ext 0.1.13

Standard library extensions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::convert::Infallible;

pub trait UnwrapInfallible {
    type Ok;
    fn unwrap_infallible(self) -> Self::Ok;
}

impl<T> UnwrapInfallible for Result<T, Infallible> {
    type Ok = T;
    fn unwrap_infallible(self) -> T {
        match self {
            Ok(val) => val,
            Err(never) => match never {},
        }
    }
}