We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
unwrap()
StatusAnd
1 parent 7db8595 commit 4ac3904Copy full SHA for 4ac3904
src/lib.rs
@@ -90,6 +90,20 @@ impl<T> StatusAnd<T> {
90
}
91
92
93
+impl<T: core::fmt::Debug> StatusAnd<T> {
94
+ /// Extract the inner value if there were no errors. If there were errors, panic.
95
+ pub fn unwrap(self) -> T {
96
+ if self.status == Status::OK {
97
+ self.value
98
+ } else {
99
+ panic!(
100
+ "called `StatusAnd::unwrap()` on an error value. Value: {:?}, status: {:?}",
101
+ self.value, self.status
102
+ );
103
+ }
104
105
+}
106
+
107
#[macro_export]
108
macro_rules! unpack {
109
($status:ident|=, $e:expr) => {
0 commit comments