linya icon indicating copy to clipboard operation
linya copied to clipboard

[feat] allow users to set label and total after Bar's initialization

Open ciehanski opened this issue 1 year ago • 3 comments

Hello!

Firstly, thank you for a fantastic crate. I appreciate how simple and easy Linya is compared to many other progress bar crates out there.

This PR would add 4 pub set helper functions which would allow the user to modify a specific Bar's total or label after the Bar has been initialized. I've found this useful in cases where I do not know the total size of the data, but I want the draw the progress bar and then update its total once gathered. In my local tests I was able to accomplish what I was after.

If there is a more optimal way to achieve this without the need for this PR, please let me know.

Thanks, ciehanski

ciehanski avatar Mar 04 '23 00:03 ciehanski

Thank you! I will take a look.

fosskers avatar Mar 06 '23 02:03 fosskers

Sorry that the review took so long! Overall it looks good. I think we can improve the naming a bit; the word "total" is a bit confusing (my own fault for the original wording). It's not clear whether it refers to the running total, or the "target total", so I suggested a switch to "target". Thoughts?

fosskers avatar May 09 '23 00:05 fosskers

Makes sense to me, I completely agree - target is more clear here than total. I've committed the changes!

ciehanski avatar May 16 '23 04:05 ciehanski