File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ fn main() {
7
7
// Required for stabilization of `unsafe_op_in_unsafe_fn` lint.
8
8
ac. emit_rustc_version ( 1 , 52 ) ;
9
9
10
- // Required for stabilization of `Vec::shrink_to()`.
10
+ // Required for stabilization of `Vec::shrink_to()` and `IntoIterator` for arrays .
11
11
ac. emit_rustc_version ( 1 , 56 ) ;
12
12
13
13
autocfg:: rerun_path ( "build.rs" ) ;
Original file line number Diff line number Diff line change @@ -1666,6 +1666,25 @@ impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
1666
1666
}
1667
1667
}
1668
1668
1669
+ /// # Compatibility
1670
+ ///
1671
+ /// This trait is only implemented for Rust 1.56.0 or greater.
1672
+ #[ cfg( rustc_1_56) ]
1673
+ impl < T : Ord , const N : usize > From < [ T ; N ] > for BinaryHeap < T > {
1674
+ /// ```
1675
+ /// use binary_heap_plus::BinaryHeap;
1676
+ ///
1677
+ /// let mut h1 = BinaryHeap::from([1, 4, 2, 3]);
1678
+ /// let mut h2: BinaryHeap<_> = [1, 4, 2, 3].into();
1679
+ /// while let Some((a, b)) = h1.pop().zip(h2.pop()) {
1680
+ /// assert_eq!(a, b);
1681
+ /// }
1682
+ /// ```
1683
+ fn from ( arr : [ T ; N ] ) -> Self {
1684
+ Self :: from_iter ( arr)
1685
+ }
1686
+ }
1687
+
1669
1688
/// # Compatibility
1670
1689
///
1671
1690
/// This trait is only implemented for Rust 1.41.0 or greater. For earlier versions, `Into<Vec<T>>`
You can’t perform that action at this time.
0 commit comments