Make `change_priority` API consistent by liwenjieQu · Pull Request #41 · garro95/priority-queue

I would rather return a bool then Option<()>.
Keep in mind that, anyway, the user could already use std::mem::replace, std::mem::swap or the unsafe take_mut crate to take out an Option(p1), where p1 is the old priority. For example, you could do something like

use priority_queue::PriorityQueue;
use std::mem::swap;

let mut pq = PriorityQueue::new();

pq.push("Apples", 5);
pq.push("Bananas", 8);
pq.push("Strawberries", 23);

let mut newp = Some(10);

pq.change_priority_by("Bananas", |p| {
  swap(p, newp.as_mut().unwrap());
});
let oldp = newp;
assert_eq!(pq.get("Bananas"), Some((&"Bananas", &10)));
assert_eq!(oldp, Some(8));