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
5use std::collections::BTreeSet;
6
7use crate::iter::plumbing::*;
8use crate::iter::*;
9
10use crate::vec;
11
12/// Parallel iterator over a B-Tree set
13#[derive(Debug)] // std doesn't Clone
14pub struct IntoIter<T: Ord + Send> {
15 inner: vec::IntoIter<T>,
16}
17
18into_par_vec! {
19 BTreeSet<T> => IntoIter<T>,
20 impl<T: Ord + Send>
21}
22
23delegate_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)]
30pub struct Iter<'a, T: Ord + Sync> {
31 inner: vec::IntoIter<&'a T>,
32}
33
34impl<'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
42into_par_vec! {
43 &'a BTreeSet<T> => Iter<'a, T>,
44 impl<'a, T: Ord + Sync>
45}
46
47delegate_iterator! {
48 Iter<'a, T> => &'a T,
49 impl<'a, T: Ord + Sync + 'a>
50}
51
52// `BTreeSet` doesn't have a mutable `Iterator`
53