clitic / kdam

A console progress bar library for Rust. (inspired by tqdm & rich.progress)
https://docs.rs/kdam
Apache License 2.0
196 stars 6 forks source link

using par_tqdm #19

Closed aou closed 6 months ago

aou commented 6 months ago

Hello! I am trying to use the par_tqdm macro as a manual builder for a bar; can't chain or create with an iterable as the steps I update with are variable in each iteration.

I suspect I'm either using it wrong, or it's not designed for my use-case -- I basically wrap it in an Arc(Mutex) and lock().unwrap().update(some_size) in the closure.

Is there another way I'm supposed to use it?

Thank you!

clitic commented 6 months ago

Currently, this use case is not supported. For now I would suggest you to use Bar and manually implement your logic.

I would also not add this in future because it is not needed. par_tqdm! returns a iterator and when you call next fn on it. It returns the original iterator value with update call on bar with value 1. So, it makes no sense in updating values manually.