pub fn read_file_with_eol_classified(
path: &Path,
) -> Result<Result<Vec<u8>, SkipReason>>Expand description
Reads a file exactly as read_file_with_eol does, but names the reason
when the file is skipped instead of collapsing every skip into None.
The outer Result is the I/O outcome; the inner one is the analysis
outcome — Ok(bytes) for a file the metric engine can parse, or
Err(SkipReason) for one it declines. read_file_with_eol is
read_file_with_eol_classified(path).map(Result::ok), so the two agree
branch for branch.
§Errors
Identical to read_file_with_eol: any std::io::Error from
File::open or the subsequent reads propagates. Skips are not errors —
they arrive as Ok(Err(reason)).
§Examples
use std::path::Path;
use big_code_analysis::{SkipReason, read_file_with_eol_classified};
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("tiny.rs");
std::fs::write(&path, b"x").unwrap();
assert_eq!(
read_file_with_eol_classified(&path).unwrap(),
Err(SkipReason::TooSmall)
);