]> git.lizzy.rs Git - rust.git/commit
Add PeekMut::pop
authorSteven Fackler <sfackler@gmail.com>
Sat, 31 Dec 2016 05:18:17 +0000 (21:18 -0800)
committerSteven Fackler <sfackler@gmail.com>
Mon, 2 Jan 2017 03:18:07 +0000 (19:18 -0800)
commitf2cb47adf95171e48a9f918aae00193a7d36c7c0
treec0e544501aa9ecdef3de767d662f030907504f28
parent6c9bb42ecc48ffb5a3c8b61e220b11adc3a46384
Add PeekMut::pop

A fairly common workflow is to put a bunch of stuff into a binary heap
and then mutate the top value until its empty. This both makes that a
bit more convenient (no need to save a boolean off and pop after to
avoid borrowck issues), and a bit more efficient since you only shift
once.
src/libcollections/binary_heap.rs
src/libcollectionstest/binary_heap.rs
src/libcollectionstest/lib.rs