Add InfallibleExt util trait

This commit is contained in:
Joscha 2023-04-14 01:21:58 +02:00
parent d2e3e2aef9
commit b515ace906
2 changed files with 16 additions and 0 deletions

View file

@ -21,6 +21,7 @@ mod logger;
mod macros; mod macros;
mod store; mod store;
mod ui; mod ui;
mod util;
mod vault; mod vault;
use std::path::PathBuf; use std::path::PathBuf;

15
src/util.rs Normal file
View file

@ -0,0 +1,15 @@
use std::convert::Infallible;
pub trait InfallibleExt {
type Inner;
fn infallible(self) -> Self::Inner;
}
impl<T> InfallibleExt for Result<T, Infallible> {
type Inner = T;
fn infallible(self) -> T {
self.expect("infallible")
}
}