Created
April 1, 2022 04:53
-
-
Save hussachai/27f35cf1fa7525acf48d7eab90ebbdff to your computer and use it in GitHub Desktop.
Error Handling in Rust that Every Beginner should Know Snippet 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn unwrap(self) -> T { | |
match self { | |
Ok(t) => t, | |
Err(e) => unwrap_failed("called `Result::unwrap()` on an `Err` value", &e), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment