pub fn find_files(
pattern: &str,
root: &str,
hide_hidden: bool,
case_sensitive: bool,
thread_count: usize,
keep_dirs: bool,
keep_sys_paths: bool,
max_depth: Option<usize>,
use_glob: bool,
full_path: bool,
) -> Result<Vec<OsString>, ScanError>Expand description
§Examples
use scanit::{find_files, ScanError};
fn main() -> Result<(), ScanError> {
// Find all Rust source files in current directory
let files = find_files(
r"\.rs$", // Match files ending in .rs
".", // Search in current directory
true, // Skip hidden files
false, // Case-insensitive matching
4, // Use 4 parallel threads
false, // Don't include directory paths
false, // Skip system paths
Some(5), // Search up to 5 directories deep
false, // Use regex (not glob) pattern
false, // Match against filename only
)?;
// Example output: ["main.rs", "lib.rs", "tests/common.rs"]
for path in files {
println!("{:?}", path);
}
Ok(())
}§Errors
Returns ScanError if:
- The regex pattern is invalid (
ScanError::Regex) - Directory traversal fails (
ScanError::Walk) - File system access is denied (
ScanError::Io) - Memory allocation fails during path collection