Last active
January 22, 2018 07:59
-
-
Save ichyo/74391d4c1721c3607a9c3d37dadf4768 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
use std::fs::File; | |
use std::io::BufReader; | |
use std::io::prelude::*; | |
use std::path::Path; | |
fn open<P: AsRef<Path>>(path: P) -> Result<std::io::Lines<BufReader<File>>, std::io::Error> { | |
let file = File::open(path)?; | |
let reader = BufReader::new(file); | |
Ok(reader.lines()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment