Comments (3)
Right now I can use hidden attribute on a custom progress bar based upon conditions, and the remainder of the code stays the same .... except this is very clumsy.
IteratorExact uses iterator length, and my custom progress bar (activated with iter.progress_with) then loses the length estimate. So I end up with custom extension traits etc.
I'm not sure what you mean with all this. It seems to me you can use ProgressBar::set_draw_target()
to ProgressDrawTarget::hidden()
in most cases, I'm not sure why this isn't viable with your iterator setup.
from indicatif.
This works - just sits strangely with the iterator API - so not a bug, more a comment on usability. Maybe it is because Im seeing things like "hidden" from a UI perspective.
Im used to "visible" or "hidden" being a UI-style attribute on screen components etc. For indicatif its not. Its an attribute of the bar.
For other style attributes, the idicatif API is really clean. ie
fn my_default_custom_style() -> ProgressStyle {
// omitted logic setting colors etc
}
// many loops / lots of code using iterators etc.
for item in collection.iter().progress().with_style( my_default_custom_style() ) {
// loop logic
}
// similar code as ablove repeated many times with different containers/files/iterators etc
When I try and incorporate hidden, this becomes a bit clumsy. Hidden is not in style, its an attribute of bar.
I cant change my_default_custom_style to be my_default_custom_bar as this requires setting the length, and ProgressIterator::progress_with(my_default_custom_bar()) would then not take the length from the ExactSizeIterator. All solvable, and I can add a custom extension trait to Iterator to make it cleaner, but less of a "batteries included" experience.
Please don't read this as complaining :-)
Indicatif is a great crate.
from indicatif.
I think this is a core part of the architecture of the crate -- if the progress bar is hidden we have to do less work. I would suggest you don't try to shoehorn your adapters in your pre-existing worldview that visibility is necessarily part of style.
I'm not motivated to work on changing this and fundamentally changing the API like this feels like it has an unclear cost-benefit trade-off so I'll close this issue.
from indicatif.
Related Issues (20)
- indicatif crashes with assertion failed: self.orphan_lines_count <= self.lines.len() if number of terminal columns is less than 135 HOT 11
- Finished progress bars are not preserved in `MultiProgress::println` HOT 6
- `{msg}` `.set_message(Cow<'static, str>)` design unnecessarily requires allocation HOT 3
- Question: How to get latest progress bar state string HOT 3
- Git repo is missing tag for v0.17.7 HOT 1
- Add gifs/videos in readme for each example HOT 1
- Use with Zenity HOT 7
- Intermittent `style::tests::wide_element_style` failure HOT 2
- ‘percent_precise’ do not work HOT 4
- examples/fastbar.rs rendering is different on Windows git-bash than CMD or PowerShell HOT 3
- [Meta] missing release entries for 0.17.6 and up HOT 3
- MultiProgress falls apart if the number of ProgressBars excedes the number of lines in a terminal HOT 1
- Feature Req.: Human readable `per_sec` rate HOT 3
- Using ⚙️ emoji in ProgressBar spinner message causes unnessecary line breaks HOT 23
- How do I get the progress bar to align under my design? HOT 1
- MultiProgress second ProgressBar extremely delayed HOT 3
- Stacked progress bar HOT 2
- Adding/removing progress bar spinners leaves newlines HOT 3
- No progress bar in docker logs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from indicatif.