Last active
May 18, 2016 09:31
-
-
Save tailhook/935b874a9257d6fa4b678b5fbe73ece6 to your computer and use it in GitHub Desktop.
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
enum Error { | |
Io(io::Error), | |
Parse(ParseIntError), | |
} | |
// ... | |
try!(File::open(fname) | |
.and_then(|mut f| f.read_to_string(&mut buf)) | |
.map_err(|e| Error::Io(e, fname.to_path_buf()))); | |
let x: u64 = try!(buf.parse() | |
.map_err(|e| Error::Parse(e, fname.to_path_buf()))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment