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
Right now, PriorityQueue::get_mut does not allow modifying the item of the queue (which is in line with the API of other maps in the rust ecosystem) but PriorityQueue::iter_mut does which is both inconsistent with the get_mut function and inconsistent with the API of other maps in the rust ecosystem.
I propose to add PriorityQueue::get_mut2 or PriorityQueue::get_full_mut2 and PriorityQueue::iter_mut2 similar to how the underlying IndexMap works and mark PriorityQueue::iter_mut as deprecated. Then, in the next major version, I propose to replace iter_mut with an iterator that does not allow modifying the item but just the priority.
The same is true for the DoublePriorityQueue.
If you agree to this change, I can send a PR if you want.
Btw for the motivation: My items have a "parent" that is not part of the eq/hash implementation but needs to be updated when changing the priority of the item as well, so I need the get_mut2 functionality. The alternative would be interior mutability which I'd rather not use, or iterating through the entire q to change one single element, which I'd also rather not do.
The text was updated successfully, but these errors were encountered:
Right now,
PriorityQueue::get_mut
does not allow modifying the item of the queue (which is in line with the API of other maps in the rust ecosystem) butPriorityQueue::iter_mut
does which is both inconsistent with theget_mut
function and inconsistent with the API of other maps in the rust ecosystem.I propose to add
PriorityQueue::get_mut2
orPriorityQueue::get_full_mut2
andPriorityQueue::iter_mut2
similar to how the underlyingIndexMap
works and markPriorityQueue::iter_mut
as deprecated. Then, in the next major version, I propose to replaceiter_mut
with an iterator that does not allow modifying the item but just the priority.The same is true for the
DoublePriorityQueue
.If you agree to this change, I can send a PR if you want.
Btw for the motivation: My items have a "parent" that is not part of the eq/hash implementation but needs to be updated when changing the priority of the item as well, so I need the
get_mut2
functionality. The alternative would be interior mutability which I'd rather not use, or iterating through the entire q to change one single element, which I'd also rather not do.The text was updated successfully, but these errors were encountered: