Add Progressbar

This commit is contained in:
Chaoscaot
2023-03-12 14:13:55 +01:00
parent 3792be48a3
commit 916613773b
3 changed files with 16 additions and 14 deletions

View File

@ -15,6 +15,7 @@ clap = { version = "4.1.8", features = ["cargo"] }
futures = { version = "0.3", optional = true }
sqlx = { version = "0.6", features = [ "runtime-async-std-native-tls" , "mysql" ], optional = true }
rayon = "1.7.0"
indicatif = { version = "0.17.3", features = ["rayon"] }
[features]
sql = ["dep:schemsearch-sql", "dep:futures", "dep:sqlx"]

View File

@ -36,6 +36,7 @@ use schemsearch_sql::filter::SchematicFilter;
use schemsearch_sql::load_all_schematics;
#[cfg(feature = "sql")]
use crate::types::SqlSchematicSupplier;
use indicatif::{ProgressBar, ParallelProgressIterator, ProgressStyle};
fn main() {
#[allow(unused_mut)]
@ -256,7 +257,7 @@ fn main() {
}
ThreadPoolBuilder::new().num_threads(*matches.get_one::<usize>("threads").expect("Could not get threads")).build_global().unwrap();
let matches: Vec<Result> = schematics.par_iter().map(|schem| {
let matches: Vec<Result> = schematics.par_iter().progress_with_style(ProgressStyle::default_bar()).map(|schem| {
match schem {
SchematicSupplierType::PATH(schem) => {
let schematic = match load_schem(&schem.path) {