pub trait ContentScanner: Scanner {
// Required method
fn config(&self) -> &ScannerConfig;
// Provided method
fn scan_content(
&self,
content: &str,
file_path: &str,
) -> Result<Vec<Finding>> { ... }
}Expand description
Extended trait for scanners that support content-based scanning.
This trait provides a unified interface for scanning raw content strings, which is useful for testing and for scanners that parse structured files (like JSON) before applying rules.
Required Methods§
Sourcefn config(&self) -> &ScannerConfig
fn config(&self) -> &ScannerConfig
Returns a reference to the scanner’s configuration.
Provided Methods§
Sourcefn scan_content(&self, content: &str, file_path: &str) -> Result<Vec<Finding>>
fn scan_content(&self, content: &str, file_path: &str) -> Result<Vec<Finding>>
Scans content and returns findings.
Default implementation delegates to ScannerConfig::check_content. Override this method for scanners that need custom content processing (e.g., JSON parsing, frontmatter extraction).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".