rceaadb/src/file.rs

10 lines
300 B
Rust
Raw Normal View History

2020-01-02 17:51:02 +01:00
use std::fs::File;
use std::io::{prelude::*, BufReader};
pub fn read_file(path: &'static str) -> impl Iterator<Item = String> {
let reader = BufReader::new(File::open(path).expect("File not found"));
reader
.lines()
.map(|l| l.expect(&format!("Could not read from file")))
}