Skip to main content

scan_version

Function scan_version 

Source
pub fn scan_version(
    scanner: &CandidateScanner,
    store: &mut dyn CandidateBytes,
    version: &CandidateVersion,
    rules_path: Option<&[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); Option<&[u8]> is “the rules file’s candidate pathname or nothing”; 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[]>;