1 //! This module contains the parallel iterator types for heaps
2 //! (`BinaryHeap<T>`). You will rarely need to interact with it directly
3 //! unless you have need to name one of the iterator types.
5 use std
::collections
::BinaryHeap
;
7 use crate::iter
::plumbing
::*;
12 /// Parallel iterator over a binary heap
13 #[derive(Debug, Clone)]
14 pub struct IntoIter
<T
: Ord
+ Send
> {
15 inner
: vec
::IntoIter
<T
>,
18 impl<T
: Ord
+ Send
> IntoParallelIterator
for BinaryHeap
<T
> {
20 type Iter
= IntoIter
<T
>;
22 fn into_par_iter(self) -> Self::Iter
{
24 inner
: Vec
::from(self).into_par_iter(),
29 delegate_indexed_iterator
! {
34 /// Parallel iterator over an immutable reference to a binary heap
36 pub struct Iter
<'a
, T
: Ord
+ Sync
> {
37 inner
: vec
::IntoIter
<&'a T
>,
40 impl<'a
, T
: Ord
+ Sync
> Clone
for Iter
<'a
, T
> {
41 fn clone(&self) -> Self {
43 inner
: self.inner
.clone(),
49 &'a BinaryHeap
<T
> => Iter
<'a
, T
>,
50 impl<'a
, T
: Ord
+ Sync
>
53 delegate_indexed_iterator
! {
55 impl<'a
, T
: Ord
+ Sync
+ 'a
>
58 // `BinaryHeap` doesn't have a mutable `Iterator`