Conversation
|
It's been a while since I looked at |
|
Thanks for your response, @chris-laplante . Let me give you a bit of background why I thought this might be useful. There is a crate that I have found convenient to use - https://github.com/emersonford/tracing-indicatif . Without access to I.e the order of progress bars would be wrong (child 2 would be before child 1). This is a known issue in this crate, which I have managed to fix (test passes in that linked revision) by using custom version of indicatif (from which this PR is created) and by calling index() - strowk/tracing-indicatif@cf0cb0a#diff-a646224308d682586cd49b1953007c405ab373195b6e3c08ed2e1ae0cbe17a52R239-R241 Now, as you can see in that bit above, this works as a combination of index() and insert: let parent_index = parent_pb.index().unwrap_or(0);
self.mp.insert(
parent_index + siblings_offset,
pb_span_ctx.progress_bar.take().unwrap(),
), which in theory could've work like this: self.mp.insert_after_with_offset(
parent_pb,
siblings_offset,
pb_span_ctx.progress_bar.take().unwrap(),
), given if indicatif supported a method Lines 140 to 142 in e1f410d , but also take offset to add to index. This could be alternative approach that would also fix the issue in tracing-indicatif. Now, I do not actually know whether author of tracing-indicatif would agree with either of those honestly :) I also can in principle live without either of these being fixed in upstreams, my forks of both indicatif and indicatif-tracing kind of work for me at the moment. So you are free to close this as well, no big. |
This could be useful for some user crates, for example potentially can help solve the issue with order of child progress bars that exists in this crate - https://github.com/emersonford/tracing-indicatif/blob/main/src/pb_manager.rs#L217-L221