fe-cli-vgd 0.1.0

A tool to search files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::io::BufRead;

pub fn find_matches(
    reader: &mut impl BufRead,
    pattern: &str,
    writer: &mut impl std::io::Write,
) -> std::io::Result<()> {
    for (_i, line) in reader.lines().flat_map(|x| x.ok()).enumerate() {
        if line.contains(pattern) {
            writeln!(writer, "{}", line)?;
        }
    }
    Ok(())
}