|0.2.0||May 27, 2019|
|0.1.6||May 21, 2019|
|0.1.4||May 18, 2018|
#112 in Data structures
320 downloads per month
Used in 1 crate
Enhancement over Rust's
It supports the following features and still maintains backward compatibility.
- Max heap
- Min heap
- Heap ordered by closure
- Heap ordered by key generated by closure
You can change the line
to like below.
Your code will compile as before unless you use unstable APIs.
This crate requires Rust 1.26 or later.
::new()// creates a max heap
::new_min()// creates a min heap
::new_by(f)// creates a heap ordered by the given closure
::new_by_key(g)// creates a heap ordered by key generated by the given closure
::with_capacity(n)// creates a max heap with capacity
::with_capacity_min(n)// creates a min heap with capacity
::with_capacity_by(n, f)// creates a heap with capacity
n, ordered by the given closure
::with_capacity_by_key(n, g)// creates a heap with capacity
n, ordered by key generated by the given closure
From<Vec<T>> trait is implemented for max heap only.
If you add generic impl for other heaps, the existing code breaks, requires
slight modification such as type annotation.
To maintain good compatibility with
::from_vec() method was added
for the same purpose.
- [COMPATIBILITY CHANGE] Use
comparecrate instead of our own definition. Most users should not be affected by this. TIP: External
Compare<T>impls needs to be updated to use
- [COMPATIBILITY CHANGE] rename feature
serdein order to comply with the guideline: https://rust-lang-nursery.github.io/api-guidelines/interoperability.html#c-serde
- Refactor ctor impl.
- Add generic constructor
- Refactor other ctor to call above methods.
serde1feature which adds Serialize/Deserialize
- Merge #1) Do not require T: Ord when a custom comparator is provided
- Add comprehensive CI based on
trustCI template v0.1.2
- README.md tweaks.
- Cargo.toml tweaks
- I received many valuable feedback from Pre-RFC thread .
- The current design is based on @ExpHP's suggestion that compiles on stable compiler.
- DDOtten, steven099, CAD97, ExpHP, scottmcm, Nemo157 and gnzlbg, thanks for looking into the design!
- @ulysseB sent me a first pull request!
- @inesseq contributed feature
See the following discussions for the background of the crate: