Add InfallibleExt util trait
This commit is contained in:
parent
d2e3e2aef9
commit
b515ace906
2 changed files with 16 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ mod logger;
|
|||
mod macros;
|
||||
mod store;
|
||||
mod ui;
|
||||
mod util;
|
||||
mod vault;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
|
|
|||
15
src/util.rs
Normal file
15
src/util.rs
Normal 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")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue