summaryrefslogtreecommitdiffstats
path: root/vendor/bstr/examples/lines-std.rs
blob: 69fc6a586c717ed34640e25939502a0c54427d77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::error::Error;
use std::io::{self, BufRead, Write};

fn main() -> Result<(), Box<dyn Error>> {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    let mut stdout = io::BufWriter::new(io::stdout());

    let mut line = String::new();
    while stdin.read_line(&mut line)? > 0 {
        if line.contains("Dimension") {
            stdout.write_all(line.as_bytes())?;
        }
        line.clear();
    }
    Ok(())
}