]> git.proxmox.com Git - rustc.git/blame - vendor/rayon/src/collections/linked_list.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / vendor / rayon / src / collections / linked_list.rs
CommitLineData
2c00a5a8
XL
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
2c00a5a8 7use iter::plumbing::*;
416331ca 8use iter::*;
2c00a5a8
XL
9
10use 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
416331ca 18into_par_vec! {
2c00a5a8
XL
19 LinkedList<T> => IntoIter<T>,
20 impl<T: Send>
21}
22
416331ca 23delegate_iterator! {
2c00a5a8
XL
24 IntoIter<T> => T,
25 impl<T: Send>
26}
27
2c00a5a8
XL
28/// Parallel iterator over an immutable reference to a linked list
29#[derive(Debug)]
30pub struct Iter<'a, T: Sync + 'a> {
31 inner: vec::IntoIter<&'a T>,
32}
33
34impl<'a, T: Sync> Clone for Iter<'a, T> {
35 fn clone(&self) -> Self {
416331ca
XL
36 Iter {
37 inner: self.inner.clone(),
38 }
2c00a5a8
XL
39 }
40}
41
416331ca 42into_par_vec! {
2c00a5a8
XL
43 &'a LinkedList<T> => Iter<'a, T>,
44 impl<'a, T: Sync>
45}
46
416331ca 47delegate_iterator! {
2c00a5a8
XL
48 Iter<'a, T> => &'a T,
49 impl<'a, T: Sync + 'a>
50}
51
2c00a5a8
XL
52/// Parallel iterator over a mutable reference to a linked list
53#[derive(Debug)]
54pub struct IterMut<'a, T: Send + 'a> {
55 inner: vec::IntoIter<&'a mut T>,
56}
57
416331ca 58into_par_vec! {
2c00a5a8
XL
59 &'a mut LinkedList<T> => IterMut<'a, T>,
60 impl<'a, T: Send>
61}
62
416331ca 63delegate_iterator! {
2c00a5a8
XL
64 IterMut<'a, T> => &'a mut T,
65 impl<'a, T: Send + 'a>
66}