Skip to content
Permalink
Browse files

Add progress bar

  • Loading branch information...
ichyo committed Jun 22, 2019
1 parent 1bec8aa commit 6107a93c113865a9c417d404c69ebe0bfa05d6a1
Showing with 223 additions and 10 deletions.
  1. +207 −0 Cargo.lock
  2. +1 −0 Cargo.toml
  3. +4 −1 src/main.rs
  4. +9 −4 src/models.rs
  5. +2 −5 src/solve.rs

Some generated files are not rendered by default. Learn more.

@@ -9,6 +9,7 @@ clap = "2.33.0"
glob = "0.3.0"
rand = "0.6.5"
rayon = "1.1.0"
indicatif = "0.11.0"

[lib]
name = "icfpc"
@@ -2,6 +2,7 @@ use clap::{App, Arg};
use rayon::prelude::*;
use std::fs::File;
use std::io::Write;
use indicatif::ProgressBar;

use icfpc::models::*;
use icfpc::parse::read_all_inputs;
@@ -36,8 +37,8 @@ fn main() {
let output_root = matches.value_of("output");

let inputs = read_all_inputs(&input_root);
let progress_bar = ProgressBar::new(inputs.len() as u64);
inputs.into_par_iter().for_each(|input| {
eprintln!("{}", input.output_file_name());
let mut output_file: Box<Write> = match output_root {
Some(output_root) => {
let output_path = format!("{}/{}", output_root, input.output_file_name());
@@ -47,5 +48,7 @@ fn main() {
None => Box::new(std::io::stdout()),
};
solve(input.task, &mut output_file);
progress_bar.inc(1);
});
progress_bar.finish();
}

0 comments on commit 6107a93

Please sign in to comment.
You can’t perform that action at this time.