rtoc/
lib.rs

1use std::io::BufRead;
2
3pub fn r(fp: impl AsRef<std::path::Path>) -> aok::Result<impl IntoIterator<Item = String>> {
4  Ok(
5    std::io::BufReader::new(std::fs::File::open(fp)?)
6      .lines()
7      .filter_map(|line| {
8        if let Ok(line) = line {
9          let line = line.trim();
10          return if line.is_empty() || line.starts_with('#') {
11            None
12          } else {
13            Some(line.into())
14          };
15        }
16        None
17      }),
18  )
19}