]>
git.proxmox.com Git - rustc.git/blob - src/doc/book/listings/ch09-error-handling/no-listing-03-closures/src/main.rs
2 use std
::io
::ErrorKind
;
5 let f
= File
::open("hello.txt").unwrap_or_else(|error
| {
6 if error
.kind() == ErrorKind
::NotFound
{
7 File
::create("hello.txt").unwrap_or_else(|error
| {
8 panic
!("Problem creating the file: {:?}", error
);
11 panic
!("Problem opening the file: {:?}", error
);