radix-heap
radix-heap copied to clipboard
switched `RadixHeapMap::push()` to return a Result
Switched RadixHeapMap::push() to return a Result rather than simply panicking when given a greater key than the current top key.
This is a nicer API to work with as it allows the caller to choose how they want to handle such an error rather than being forced to panic.
The use-case that inspired this change was I was trying to debug a scenario when a greater key was given by catching the faulty push and doing some dbg!()s but I was unable to since push() panics internally.