1 2 3 4 5 6 7 8 9 10 11
pub use std::convert::Infallible; pub trait InfallibleInto<T> { fn infallible(self) -> T; } impl<T> InfallibleInto<T> for Result<T, Infallible> { fn infallible(self) -> T { self.unwrap_or_else(|e| match e {}) } }