Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub num_threads: usize,
    pub num_entries: usize,
    pub batch_size: usize,
    pub root_path: PathBuf,
    pub skip_dirs: HashSet<String>,
    pub max_open_files: usize,
    pub verbose: bool,
}
Expand description

Configuration structure containing runtime settings.

§Fields

  • num_threads - Number of threads to use in parallel processing
  • num_entries - Number of entries to output at program completion
  • batch_size - Size of batches for processing file metadata
  • root_path - Base directory path to recursively find and size files
  • skip_dirs - Set of directory names to exclude from the search
  • max_open_files - Maximum number of open file handles used by this program
  • verbose - Bool to determine if errors collected during runtime will be printed

Fields§

§num_threads: usize§num_entries: usize§batch_size: usize§root_path: PathBuf§skip_dirs: HashSet<String>§max_open_files: usize§verbose: bool

Implementations§

Source§

impl Config

Source

pub fn build(args: &Args) -> Result<Config, Box<dyn Error>>

Builds a new Config instance from provided command line arguments.

§Parameters
  • args - Reference to Args structure containing command line arguments
§Returns
  • Result<Config, Box<dyn Error>> - New Config instance or error if construction fails
§Details

This function performs the following setup:

  1. Configures parallel processing based on available CPU cores
  2. Calls a library function to determine platform specific cap on open file descriptors
  3. Sets number of entries to output equal to provided command line arg or default of 10
  4. Sets batch size to match command line arg if specified or else default to 1000
  5. Sets verbose bool to match command line arg
  6. Sets up the root directory path for operations
  7. Loads directory exclusion rules if file containing dirs was supplied
§Errors

Returns an error if:

  • Current directory cannot be determined when no target directory is specified
  • Exclusion file cannot be opened or read
  • Thread pool configuration fails (logged as error but doesn’t halt execution)

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.