Struct Scanner

Source
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

Source

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);
Source

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:

  1. Directory traversal to identify potential projects
  2. 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.