Last active
August 29, 2015 13:57
-
-
Save abaez/9925922 to your computer and use it in GitHub Desktop.
A quick gist for reader buffer from file.
This file contains hidden or 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::path::Path; | |
use std::io::{File, BufferedReader}; | |
/// opens a path to read a file. | |
fn open(p: &str) -> BufferedReader<File> { | |
BufferedReader::new(match File::open(&Path::new(p)) { | |
Ok(f) => f, | |
Err(e) => panic!("file error: {}", e) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment