fmt
This commit is contained in:
parent
80382751df
commit
7d17e904fc
13
src/main.rs
13
src/main.rs
@ -244,7 +244,6 @@ impl<T> SplitTo<T> for Vec<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn process_files(files: &&[PathBuf]) {
|
fn process_files(files: &&[PathBuf]) {
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
return;
|
return;
|
||||||
@ -302,15 +301,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let out_dir: PathBuf = OUTPUT_PATH.into();
|
let out_dir: PathBuf = OUTPUT_PATH.into();
|
||||||
if out_dir.is_file() {
|
if out_dir.is_file() {
|
||||||
return Err("output directory is file!".into());
|
return Err("output directory is file!".into());
|
||||||
}
|
} else if !out_dir.exists() {
|
||||||
else if !out_dir.exists() {
|
|
||||||
fs::create_dir_all(out_dir)?;
|
fs::create_dir_all(out_dir)?;
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("processing {} files with {} threads...", source_files.len(), rayon::current_num_threads());
|
println!(
|
||||||
|
"processing {} files with {} threads...",
|
||||||
|
source_files.len(),
|
||||||
|
rayon::current_num_threads()
|
||||||
|
);
|
||||||
|
|
||||||
// split vector and process its parts in parallel
|
// split vector and process its parts in parallel
|
||||||
source_files.split_to(rayon::current_num_threads())
|
source_files
|
||||||
|
.split_to(rayon::current_num_threads())
|
||||||
.par_iter()
|
.par_iter()
|
||||||
.for_each(process_files);
|
.for_each(process_files);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user