-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiProgress: prune 'zombie' progress bars; fixes #426; add render tests #438
Conversation
9f7ca0c
to
02112d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty sensible, commented on some possible improvements.
src/multi.rs
Outdated
} | ||
|
||
#[derive(Default)] | ||
struct MultiStateElement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with draw_state: Option<_>
and is_zombie: bool
we have 4 different states. Do we need all 4? Maybe that would be a useful thing to explain in a comment?
I was surprised Weak
implements Default
-- it clearly works but it feels a little ugly to me. If we can collapse some of the states maybe there's something better we can do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, only three states are necessary:
- On
MultiProgress::internalize
(and before draw)draw_state
will beNone
andis_zombie
will befalse
. - On draw,
draw_state
will beSome(..)
andis_zombie
will befalse
. - When a zombie is detected,
is_zombie
will becometrue
. Normallydraw_state
will beSome(..)
but I suppose it's possible for a pb to be briefly in zombie state if it was never drawn (i.e. you immediately drop it after adding to theMultiProgress
).
I'll add a comment to this effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option would be to have an enum, but I think that would make the code even uglier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "suppose it's possible", I think you're suggesting that we actually do have 4 states?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are technically four states. But state 3 and 4 (with 4 being "is_zombie == true" and "draw_state is None") are handled the same.
02112d0
to
5fcad34
Compare
OK, this should be a little better (hopefully) |
Would you mind squashing the review feedback commit back into the originating commit? Would make reviewing easier. |
5fcad34
to
d87f3cc
Compare
OK, squashed. Sorry about that. I know I need to get better at structuring my commits :/ |
No description provided.