summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs')
-rw-r--r--src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs b/src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs
new file mode 100644
index 000000000..69da109fe
--- /dev/null
+++ b/src/doc/book/listings/ch09-error-handling/listing-09-04/src/main.rs
@@ -0,0 +1,10 @@
+use std::fs::File;
+
+fn main() {
+ let greeting_file_result = File::open("hello.txt");
+
+ let greeting_file = match greeting_file_result {
+ Ok(file) => file,
+ Err(error) => panic!("Problem opening the file: {:?}", error),
+ };
+}