You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this library for showing download progress. Occasionally, servers don't specify a Content-Length header, so the total download size is unknown.
This lead to my code calling progress.bar(0) which works, but leads to a panic later on when progress.set_and_draw(&bar, value) is called:
thread 'main' panicked at 'attempt to divide by zero', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/linya-0.2.1/src/lib.rs:200:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
My current workaround is this:
let bar_size = if download_size > 0{ download_size }else{1};let progress_bar = progress.bar(bar_size,&url);
This works, but it's not apparent to the user that his progress bar is not finished yet. It would be nice if there was some kind of spinner style bar when the total size is 0 (that is updated manually each time set_and_draw is used), and some explicit way to mark the bar as finished.
(Thanks for this great library btw, finally one that actually supports multibars with a single thread).
The text was updated successfully, but these errors were encountered:
I'm using this library for showing download progress. Occasionally, servers don't specify a
Content-Length
header, so the total download size is unknown.This lead to my code calling
progress.bar(0)
which works, but leads to a panic later on whenprogress.set_and_draw(&bar, value)
is called:My current workaround is this:
This works, but it's not apparent to the user that his progress bar is not finished yet. It would be nice if there was some kind of spinner style bar when the total size is
0
(that is updated manually each timeset_and_draw
is used), and some explicit way to mark the bar as finished.(Thanks for this great library btw, finally one that actually supports multibars with a single thread).
The text was updated successfully, but these errors were encountered: