Skip to main content

Scanner

Trait Scanner 

Source
pub trait Scanner {
    // Required methods
    fn scan_file(&self, path: &Path) -> Result<Vec<Finding>>;
    fn scan_directory(&self, dir: &Path) -> Result<Vec<Finding>>;

    // Provided method
    fn scan_path(&self, path: &Path) -> Result<Vec<Finding>> { ... }
}
Expand description

Core trait for all security scanners.

Scanners implement this trait to provide file and directory scanning capabilities. The default scan_path implementation handles path validation and delegates to either scan_file or scan_directory based on the path type.

Required Methods§

Source

fn scan_file(&self, path: &Path) -> Result<Vec<Finding>>

Scan a single file and return findings.

Source

fn scan_directory(&self, dir: &Path) -> Result<Vec<Finding>>

Scan a directory and return findings.

Provided Methods§

Source

fn scan_path(&self, path: &Path) -> Result<Vec<Finding>>

Scan a path (file or directory).

This is the main entry point for scanning. It validates the path and delegates to either scan_file or scan_directory.

Implementors§