MCPcopy Create free account
hub / github.com/douglance/devsql / count_lines

Function count_lines

crates/devsql/src/providers/source_files.rs:60–66  ·  view source on GitHub ↗

Count lines in a file using a buffered reader without holding the entire file contents in memory.

(path: &Path)

Source from the content-addressed store, hash-verified

58/// Count lines in a file using a buffered reader without holding the entire
59/// file contents in memory.
60fn count_lines(path: &Path) -> usize {
61 let Ok(file) = std::fs::File::open(path) else {
62 return 0;
63 };
64 let reader = BufReader::new(file);
65 reader.lines().count()
66}

Callers 1

loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected