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.
2 parents 29bb99b + f8b1f59 commit b4326d0Copy full SHA for b4326d0
src/lib.rs
@@ -618,6 +618,18 @@ impl<T> CtOption<T> {
618
}
619
620
621
+ /// Returns the contained value, consuming the `self` value.
622
+ ///
623
+ /// # Panics
624
625
+ /// Panics if the value is none with a custom panic message provided by
626
+ /// `msg`.
627
+ pub fn expect(self, msg: &str) -> T {
628
+ assert_eq!(self.is_some.unwrap_u8(), 1, "{}", msg);
629
+
630
+ self.value
631
+ }
632
633
/// This returns the underlying value but panics if it
634
/// is not `Some`.
635
#[inline]
0 commit comments