Skip to content

Instantly share code, notes, and snippets.

@abaez
Last active August 29, 2015 13:57
Show Gist options
  • Save abaez/9925922 to your computer and use it in GitHub Desktop.
Save abaez/9925922 to your computer and use it in GitHub Desktop.
A quick gist for reader buffer from file.
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