File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 4
4
5
5
Enhancement over Rust's ` std::collections::BinaryHeap ` .
6
6
7
- It supports the following features and still maintains backward compatibility.
7
+ It supports the following heaps and still maintains backward compatibility.
8
8
- Max heap
9
+ - Use ` BinaryHeap::new() ` or ` ::with_capacity() `
9
10
- Min heap
11
+ - Use ` BinaryHeap::new_min() ` or ` ::with_capacity_min() `
10
12
- Heap ordered by closure
13
+ - Use ` BinaryHeap::new_by() ` or ` ::with_capacity_by() `
11
14
- Heap ordered by key generated by closure
15
+ - Use ` BinaryHeap::new_by_key() ` or ` ::with_capacity_by_key() `
12
16
13
- Notable added method is:
14
- - ` .into_iter_sorted() ` backported from ` std ` .
17
+ Other notable added methods are:
18
+ - ` BinaryHeap::from_vec_cmp() ` and ` BinaryHeap::from_vec() ` for more generic construction.
19
+ - ` .into_iter_sorted() ` which is less-surprising version of ` .into_iter() ` . The implementation is backported from ` std ` .
15
20
16
21
## MSRV (Minimum Supported Rust Version)
17
22
18
23
This crate requires Rust 1.31.1 or later.
19
24
20
- ## Note on ` BinaryHeap::from_vec() `
21
-
22
- Currently, the ` From<Vec<T>> ` trait is implemented for max heap only.
23
- If you add generic impl for other heaps, the existing code breaks, requires
24
- slight modification such as type annotation.
25
-
26
- To maintain good compatibility with ` std ` version, ` ::from_vec() ` method was added
27
- for the same purpose.
28
-
29
25
# Changes
30
26
31
27
See CHANGELOG.md.
You can’t perform that action at this time.
0 commit comments