blob: 13ad5d0be28960cfa712fda91f543a590e1c890c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use std::{
fs,
io::{self, BufRead, BufReader},
path::Path,
};
pub fn file_contains_line(path: &Path, searched_line: &str) -> io::Result<bool> {
for line in BufReader::new(fs::File::open(path)?).lines() {
if line? == searched_line {
return Ok(true);
}
}
Ok(false)
}
|