pub fn count_file(path: impl AsRef<Path>) -> Result<Locs>Expand description
Count LOC in a single file.
§Example
use rustloclib::count_file;
use std::fs;
use tempfile::tempdir;
let dir = tempdir().unwrap();
let file_path = dir.path().join("main.rs");
fs::write(&file_path, "fn main() {\n println!(\"Hello\");\n}\n").unwrap();
let stats = count_file(&file_path).unwrap();
assert_eq!(stats.code, 3);