| 1 |
//! This module contains the parallel iterator types for B-Tree sets |
| 2 |
//! (`BTreeSet<T>`). You will rarely need to interact with it directly |
| 3 |
//! unless you have need to name one of the iterator types. |
| 4 |
|
| 5 |
use std::collections::BTreeSet; |
| 6 |
|
| 7 |
use crate::iter::plumbing::*; |
| 8 |
use crate::iter::*; |
| 9 |
|
| 10 |
use crate::vec; |
| 11 |
|
| 12 |
/// Parallel iterator over a B-Tree set |
| 13 |
#[derive(Debug)] // std doesn't Clone |
| 14 |
pub struct IntoIter<T: Ord + Send> { |
| 15 |
inner: vec::IntoIter<T>, |
| 16 |
} |
| 17 |
|
| 18 |
into_par_vec! { |
| 19 |
BTreeSet<T> => IntoIter<T>, |
| 20 |
impl<T: Ord + Send> |
| 21 |
} |
| 22 |
|
| 23 |
delegate_iterator! { |
| 24 |
IntoIter<T> => T, |
| 25 |
impl<T: Ord + Send> |
| 26 |
} |
| 27 |
|
| 28 |
/// Parallel iterator over an immutable reference to a B-Tree set |
| 29 |
#[derive(Debug)] |
| 30 |
pub struct Iter<'a, T: Ord + Sync> { |
| 31 |
inner: vec::IntoIter<&'a T>, |
| 32 |
} |
| 33 |
|
| 34 |
impl<'a, T: Ord + Sync + 'a> Clone for Iter<'a, T> { |
| 35 |
fn clone(&self) -> Self { |
| 36 |
Iter { |
| 37 |
inner: self.inner.clone(), |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
into_par_vec! { |
| 43 |
&'a BTreeSet<T> => Iter<'a, T>, |
| 44 |
impl<'a, T: Ord + Sync> |
| 45 |
} |
| 46 |
|
| 47 |
delegate_iterator! { |
| 48 |
Iter<'a, T> => &'a T, |
| 49 |
impl<'a, T: Ord + Sync + 'a> |
| 50 |
} |
| 51 |
|
| 52 |
// `BTreeSet` doesn't have a mutable `Iterator` |