1use std::fmt::Debug;
5
6pub trait UnwrapExt {
8 type Output;
9
10 fn unwrap_all(self) -> Self::Output;
24}
25
26impl<T, E: Debug> UnwrapExt for Result<Option<T>, E> {
27 type Output = T;
28
29 fn unwrap_all(self) -> Self::Output {
30 self.unwrap().unwrap()
31 }
32}
33
34impl<T, E1: Debug, E2: Debug> UnwrapExt for Result<Result<T, E1>, E2> {
35 type Output = T;
36
37 fn unwrap_all(self) -> Self::Output {
38 self.unwrap().unwrap()
39 }
40}
41
42impl<T, E: Debug> UnwrapExt for Option<Result<T, E>> {
43 type Output = T;
44
45 fn unwrap_all(self) -> Self::Output {
46 self.unwrap().unwrap()
47 }
48}
49
50impl<T> UnwrapExt for Option<Option<T>> {
51 type Output = T;
52
53 fn unwrap_all(self) -> Self::Output {
54 self.unwrap().unwrap()
55 }
56}