-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Request for comment; not ready for merge]: add insert_after / insert_before to MultiProgress #327
Conversation
This greatly simplifies the code. It also clarifies the API very nicely: the old MultiProgress::insert method is not practically useful since the indices do not necessarilly correspond to visual order, except for specific usage patterns. The ability to insert after/before particular progress bars is much more useful.
This pull request leverages a new crate I developed (https://github.com/Agilent/generational_token_list). I developed it specifically for this use-case. I realize it is a breaking API change, but I think it is beneficial since the previous Still to do here:
|
No-op merge since the functionality that the conflicting commit added is not needed.
I'm on the fence about using your crate. Basically, this seems to exchange the use of indices (with panics at run-time if we get it wrong) for something more efficient that relies on unsafe code. Since our use of this functionality seems fairly limited, I'm not sure it makes sense to use something like your crate over just using indexes. We could wrap the current code in a separate type to make it easier to verify. Even if your crate was very well tested (with comprehensive test coverage including Miri) and audited by someone conversant in unsafe, I'm not sure I'd be up for doing this here. |
The only use of |
Actually, I think I can implement |
That would be great! I do agree the |
OK great :). Ah, I think something like this will work actually:
|
See #331 instead |
@djc Do you think there's any chance I could reconstitute this changeset (i.e. using |
Let's discuss this in a new issue? Can you layout the core problem and why the generational list is your preferred way to solve it? |
This greatly simplifies the code. It also clarifies the API very nicely:
the old MultiProgress::insert method is not practically useful since the
indices do not necessarilly correspond to visual order, except for
specific usage patterns.
The ability to insert after/before particular progress bars is much more
useful.