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() {
77 // Required for stabilization of `unsafe_op_in_unsafe_fn` lint.
88 ac. emit_rustc_version ( 1 , 52 ) ;
99
10- // Required for stabilization of `Vec::shrink_to()`.
10+ // Required for stabilization of `Vec::shrink_to()` and `IntoIterator` for arrays .
1111 ac. emit_rustc_version ( 1 , 56 ) ;
1212
1313 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> {
16661666 }
16671667}
16681668
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+
16691688/// # Compatibility
16701689///
16711690/// 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