use std::fmt::Debug;
pub trait UnwrapExt {
type Output;
fn unwrap_all(self) -> Self::Output;
}
impl<T, E: Debug> UnwrapExt for Result<Option<T>, E> {
type Output = T;
fn unwrap_all(self) -> Self::Output {
self.unwrap().unwrap()
}
}
impl<T, E1: Debug, E2: Debug> UnwrapExt for Result<Result<T, E1>, E2> {
type Output = T;
fn unwrap_all(self) -> Self::Output {
self.unwrap().unwrap()
}
}
impl<T, E: Debug> UnwrapExt for Option<Result<T, E>> {
type Output = T;
fn unwrap_all(self) -> Self::Output {
self.unwrap().unwrap()
}
}
impl<T> UnwrapExt for Option<Option<T>> {
type Output = T;
fn unwrap_all(self) -> Self::Output {
self.unwrap().unwrap()
}
}