aa4e57ca8f
Implement ordered/sorted iterators on BinaryHeap as per #59278 I've implemented the ordered version of iterator on BinaryHeap as per #59278. # Added methods: * `.into_iter_sorted()` * like `.into_iter()`; but returns elements in heap order * `.drain_sorted()` * like `.drain()`; but returns elements in heap order * It's a bit _lazy_; elements are removed on drop. (Edit: it’s similar to vec::Drain) For `DrainSorted` struct, I implemented `Drop` trait following @scottmcm 's [suggestion](https://github.com/rust-lang/rust/issues/59278#issuecomment-537306925) # ~TODO~ DONE * ~I think I need to add more tests other than doctest.~ # **Notes:** * we renamed `_ordered` to `_sorted`, because the latter is more common in rust libs. (as suggested by @KodrAus ) |
||
---|---|---|
.. | ||
alloc | ||
benches | ||
collections | ||
prelude | ||
raw_vec | ||
rc | ||
sync | ||
tests | ||
alloc.rs | ||
borrow.rs | ||
boxed.rs | ||
Cargo.toml | ||
fmt.rs | ||
lib.rs | ||
macros.rs | ||
raw_vec.rs | ||
rc.rs | ||
slice.rs | ||
str.rs | ||
string.rs | ||
sync.rs | ||
tests.rs | ||
vec.rs |