1//! This module contains the parallel iterator types for linked lists
2//! (`LinkedList<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::LinkedList;
6
7use crate::iter::plumbing::*;
8use crate::iter::*;
9
10use crate::vec;
11
12/// Parallel iterator over a linked list
13#[derive(Debug, Clone)]
14pub struct IntoIter<T: Send> {
15 inner: vec::IntoIter<T>,
16}
17
18into_par_vec! {
19 LinkedList<T> => IntoIter<T>,
20 impl<T: Send>
21}
22
23delegate_iterator! {
24 IntoIter<T> => T,
25 impl<T: Send>
26}
27
28/// Parallel iterator over an immutable reference to a linked list
29#[derive(Debug)]
30pub struct Iter<'a, T: Sync> {
31 inner: vec::IntoIter<&'a T>,
32}
33
34impl<'a, T: Sync> 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 LinkedList<T> => Iter<'a, T>,
44 impl<'a, T: Sync>
45}
46
47delegate_iterator! {
48 Iter<'a, T> => &'a T,
49 impl<'a, T: Sync + 'a>
50}
51
52/// Parallel iterator over a mutable reference to a linked list
53#[derive(Debug)]
54pub struct IterMut<'a, T: Send> {
55 inner: vec::IntoIter<&'a mut T>,
56}
57
58into_par_vec! {
59 &'a mut LinkedList<T> => IterMut<'a, T>,
60 impl<'a, T: Send>
61}
62
63delegate_iterator! {
64 IterMut<'a, T> => &'a mut T,
65 impl<'a, T: Send + 'a>
66}
67