grrs-tutorial 0.1.0

Basic implementation of this tutorial: https://rust-cli.github.io/book/
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub fn find_matches(content: &str, pattern: &str, mut writer: impl std::io::Write) {
    for line in content.lines() {
        if line.contains(pattern) {
            // This returns a Result, in case of the writing failing.
            // And the tutorial tells us that!
            let result = writeln!(writer, "{}", line);

            match result {
                // Should this pass additional data?
                Err(_) => {
                    println!("Buffer writing error encountered");
                    return
                },
                _ => {}
            }
        }
    }
}