Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //example for Ok and Err
- use std::fs::File;
- fn main() {
- let f = File::open("hello.txt");
- let f = match f {
- Ok(file) => file,
- Err(error) => {
- panic!("There was a problem opening the file: {:?}", error) // as thereβs no file named hello.txt and if we run this code, weβll see the following error thread 'main' panicked at 'There was a problem opening the file
- },
- };
- }
Add Comment
Please, Sign In to add comment