parallel_disk_usage/hardlink/link_path_list/
iter.rs1use super::LinkPathList;
2use pipe_trait::Pipe;
3use std::{iter::FusedIterator, path::PathBuf, slice};
4
5#[derive(Debug, Clone)]
7pub struct Iter<'a>(slice::Iter<'a, PathBuf>);
8
9impl LinkPathList {
10 pub fn iter(&self) -> Iter<'_> {
12 self.0.iter().pipe(Iter)
13 }
14}
15
16impl<'a> Iterator for Iter<'a> {
17 type Item = &'a PathBuf;
18
19 #[inline]
20 fn next(&mut self) -> Option<Self::Item> {
21 self.0.next()
22 }
23
24 #[inline]
25 fn size_hint(&self) -> (usize, Option<usize>) {
26 self.0.size_hint()
27 }
28
29 #[inline]
30 fn count(self) -> usize {
31 self.0.count()
32 }
33
34 #[inline]
35 fn nth(&mut self, n: usize) -> Option<Self::Item> {
36 self.0.nth(n)
37 }
38
39 #[inline]
40 fn last(self) -> Option<Self::Item> {
41 self.0.last()
42 }
43}
44
45impl<'a> DoubleEndedIterator for Iter<'a> {
46 #[inline]
47 fn next_back(&mut self) -> Option<Self::Item> {
48 self.0.next_back()
49 }
50
51 #[inline]
52 fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
53 self.0.nth_back(n)
54 }
55}
56
57impl<'a> ExactSizeIterator for Iter<'a> {
58 #[inline]
59 fn len(&self) -> usize {
60 self.0.len()
61 }
62}
63
64impl FusedIterator for Iter<'_> {}