Created
May 15, 2016 16:50
-
-
Save anonymous/7cf48f69f2571989d4031e652471cb12 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
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
use std::io::prelude::*; | |
use std::fs::File; | |
use std::io::{ Error, ErrorKind }; | |
fn open_file(path: &str) -> Vec<u8> { | |
let mut f = match File::open( path ) { | |
Ok(x) => x, | |
Err(e) => match e.kind() { | |
ErrorKind::NotFound => /*idk what you want to do*/, | |
ErrorKind::PermissionDenied => /*but I think you get the idea*/, | |
ErrorKind::ConnectionRefused => /*at least I hope*/, | |
ErrorKind::ConnectionReset => /*because I'm not doing all*/, | |
.... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment