pub struct Scanner { /* private fields */ }
Expand description
Directory scanner for detecting development projects.
The Scanner
struct encapsulates the logic for traversing directory trees
and identifying development projects (Rust and Node.js) along with their
build artifacts. It supports configurable filtering and parallel processing
for efficient scanning of large directory structures.
Implementations§
Source§impl Scanner
impl Scanner
Sourcepub fn new(scan_options: ScanOptions, project_filter: ProjectFilter) -> Self
pub fn new(scan_options: ScanOptions, project_filter: ProjectFilter) -> Self
Create a new scanner with the specified options.
§Arguments
scan_options
- Configuration for scanning behavior (threads, verbosity, etc.)project_filter
- Filter to restrict scanning to specific project types
§Returns
A new Scanner
instance configured with the provided options.
§Examples
let scan_options = ScanOptions {
verbose: true,
threads: 4,
skip: vec![],
};
let scanner = Scanner::new(scan_options, ProjectFilter::All);
Sourcepub fn scan_directory(&self, root: &Path) -> Vec<Project>
pub fn scan_directory(&self, root: &Path) -> Vec<Project>
Scan a directory tree for development projects.
This method performs a recursive scan of the specified directory to find development projects. It operates in two phases:
- Directory traversal to identify potential projects
- Parallel size calculation for build directories
§Arguments
root
- The root directory to start scanning from
§Returns
A vector of Project
instances representing all detected projects with
non-zero build directory sizes.
§Panics
This method may panic if the progress bar template string is invalid, though this should not occur under normal circumstances as the template is hardcoded and valid.
§Examples
let projects = scanner.scan_directory(Path::new("/path/to/projects"));
println!("Found {} projects", projects.len());
§Performance
This method uses parallel processing for both directory traversal and size calculation to maximize performance on systems with multiple cores and fast storage.
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
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>
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>
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