figyel_grrs_0001/lib.rs
1/// find a match for a pattern in content and write to a data stream
2pub fn find_matches(content: &str, pattern: &str, mut writer: impl std::io::Write) {
3 for line in content.lines() {
4 if line.contains(pattern) {
5 let result = writeln!(writer, "{}", line);
6 match result {
7 Ok(message) => { message }
8 Err(error) => { println!("Oh noes: {}", error); }
9 }
10 }
11 }
12}