pub fn scan_version(
scanner: &CandidateScanner,
store: &mut dyn CandidateBytes,
version: &CandidateVersion,
rules_paths: &[Vec<u8>],
) -> Result<Vec<CandidateScan>, ScanRunError>Expand description
What:
Scan each eligible candidate and return the scanner’s result for every one scanned.
&mut dyn CandidateBytes lends any byte reader for changing (it may read objects);
&[Vec<u8>] is “the rules files’ candidate pathnames, none when no file is tracked”;
Result<T, E> is “a value or a failure”.
Why:
Results are returned for clean candidates too,
so the caller can tell
“scanned and clean” from “not scanned”.
The first failure ends the pass with
no partial result,
because a partial result would look like a clean pass.
In TS you’d write (pseudocode):
async function scanVersion(scanner, store, version, rulesPath?): Promise<CandidateScan[]>;