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
Based on the documentation, I had thought that changing the priorities of items in the course of iterating over them via iter_mut would update their priority rankings in the queue. However, unless I am missing something, that does not seem to be the case.
Here is a simple example of what I mean in the form of a test:
if this test is modified to use queue.change_priority("a", Duration::new(0, 2)) rather than assigning to the priority as it is above, the return value of peek is "a" as expected.
The docs say:
It's not an error, instead, to modify the priorities, because the heap will be rebuilt once the IterMut goes out of scope.
Based on this, I had thought that changing the value of the priority when iterating over the queue via iter_mut would work the same as change_priority.
Could you tell me if this a bug, or a misunderstanding of how `PriorityQueue works?
what would be a good way to update all of the priorities at once?
thank you for your help on this!
The text was updated successfully, but these errors were encountered:
@jstrong-tios Can I add that test to the test suite of this crate? It will be distributed as the rest of the library under the terms of the GNU LGPLv3 or the MPLv2, at the user opinion
hello,
Thank you for your work on this library!
Based on the documentation, I had thought that changing the priorities of items in the course of iterating over them via
iter_mut
would update their priority rankings in the queue. However, unless I am missing something, that does not seem to be the case.Here is a simple example of what I mean in the form of a test:
the
peek
call instead returns the "b" item.if this test is modified to use
queue.change_priority("a", Duration::new(0, 2))
rather than assigning to the priority as it is above, the return value ofpeek
is"a"
as expected.The docs say:
Based on this, I had thought that changing the value of the priority when iterating over the queue via
iter_mut
would work the same aschange_priority
.Could you tell me if this a bug, or a misunderstanding of how `PriorityQueue works?
what would be a good way to update all of the priorities at once?
thank you for your help on this!
The text was updated successfully, but these errors were encountered: