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 processingnum_entries- Number of entries to output at program completionbatch_size- Size of batches for processing file metadataroot_path- Base directory path to recursively find and size filesskip_dirs- Set of directory names to exclude from the searchmax_open_files- Maximum number of open file handles used by this programverbose- 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: boolImplementations§
Source§impl Config
impl Config
Sourcepub fn build(args: &Args) -> Result<Config, Box<dyn Error>>
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:
- Configures parallel processing based on available CPU cores
- Calls a library function to determine platform specific cap on open file descriptors
- Sets number of entries to output equal to provided command line arg or default of 10
- Sets batch size to match command line arg if specified or else default to 1000
- Sets verbose bool to match command line arg
- Sets up the root directory path for operations
- 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§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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