diff --git a/src/main.rs b/src/main.rs index 945ba7b..116c75a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ mod logger; mod macros; mod store; mod ui; +mod util; mod vault; use std::path::PathBuf; diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..b6e7c97 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,15 @@ +use std::convert::Infallible; + +pub trait InfallibleExt { + type Inner; + + fn infallible(self) -> Self::Inner; +} + +impl InfallibleExt for Result { + type Inner = T; + + fn infallible(self) -> T { + self.expect("infallible") + } +}