This commit is contained in:
2022-07-10 03:42:04 +00:00
committed by GitHub
parent bbd6a8d694
commit 22185554c1
10 changed files with 272 additions and 1 deletions

View File

@@ -36,3 +36,13 @@ impl<T, E, E2> TryErr<T, E> for Result<T, E2> {
}
}
}
impl<E> TryErr<(), E> for bool {
fn try_err(self, err: E) -> Result<(), E> {
if self {
Ok(())
} else {
Err(err)
}
}
}