pub struct Scanner { /* private fields */ }Expand description
Main scanner for detecting duplicates
Implementations§
Source§impl Scanner
impl Scanner
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Scanner with default settings
This is now infallible as there are no I/O or allocation failures.
Sourcepub fn with_config(
min_block_size: usize,
similarity_threshold: f64,
) -> Result<Self>
pub fn with_config( min_block_size: usize, similarity_threshold: f64, ) -> Result<Self>
Creates a new Scanner with custom settings
Sourcepub fn with_exclude_patterns(self, patterns: Vec<String>) -> Self
pub fn with_exclude_patterns(self, patterns: Vec<String>) -> Self
Sets custom exclude patterns, replacing the defaults
Sourcepub fn with_test_files(self, include: bool) -> Self
pub fn with_test_files(self, include: bool) -> Self
Enables test file scanning (removes test file patterns from exclusions)
Sourcepub fn with_type3_detection(self, tolerance: f64) -> Result<Self>
pub fn with_type3_detection(self, tolerance: f64) -> Result<Self>
Enables Type-3 clone detection with the specified tolerance
Sourcepub fn with_ignore_manager(self, manager: IgnoreManager) -> Self
pub fn with_ignore_manager(self, manager: IgnoreManager) -> Self
Sets the ignore manager for filtering false positives
Sourcepub fn with_directives(self, enabled: bool) -> Self
pub fn with_directives(self, enabled: bool) -> Self
Enables inline directive detection (// polydup-ignore comments)
Sourcepub fn scan(&self, paths: Vec<PathBuf>) -> Result<Report>
pub fn scan(&self, paths: Vec<PathBuf>) -> Result<Report>
Scans the given paths and returns a Report with detected duplicates
Uses Rayon for parallel file processing:
- Read and parse files
- Extract functions
- Normalize and hash function bodies
- Compare hashes to find duplicates
- Apply directive-based filtering if enabled
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scanner
impl RefUnwindSafe for Scanner
impl Send for Scanner
impl Sync for Scanner
impl Unpin for Scanner
impl UnwindSafe for Scanner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more