trz-gateway-common 0.2.3

Secure Proxy / Agents implementation in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Utils for [Infallible].

use core::convert::Infallible;

/// Helper to unwrap [Result<_, Infallible>].
///
/// Such errors are always safe to unwrap without checking.
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 {
        self.unwrap_or_else(|never| match never {})
    }
}