Coverage Report

Created: 2025-02-26 06:58

/rust/registry/src/index.crates.io-6f17d22bba15001f/petgraph-0.7.1/src/macros.rs
Line
Count
Source (jump to first uncovered line)
1
macro_rules! clone_fields {
2
    ($name:ident, $($field:ident),+ $(,)*) => (
3
0
        fn clone(&self) -> Self {
4
0
            $name {
5
0
                $(
6
0
                    $field : self . $field .clone()
7
0
                ),*
8
0
            }
9
0
        }
Unexecuted instantiation: <petgraph::graph_impl::Node<_, _> as core::clone::Clone>::clone
Unexecuted instantiation: <petgraph::graph_impl::Edge<_, _> as core::clone::Clone>::clone
Unexecuted instantiation: <petgraph::graph_impl::Neighbors<_, _> as core::clone::Clone>::clone
Unexecuted instantiation: <petgraph::graph_impl::stable_graph::WalkNeighbors<_> as core::clone::Clone>::clone
10
    );
11
}
12
13
macro_rules! iterator_wrap {
14
    (impl () for
15
    struct $name: ident <$($typarm:tt),*> where { $($bounds: tt)* }
16
     item: $item: ty,
17
     iter: $iter: ty,
18
     ) => ();
19
    (
20
    impl (Iterator $($rest:tt)*)  for
21
    $(#[$derive:meta])*
22
     struct $name: ident <$($typarm:tt),*> where { $($bounds: tt)* }
23
     item: $item: ty,
24
     iter: $iter: ty,
25
     ) => (
26
        // having complex iterator types is kind of the point of this macro
27
        #[allow(clippy::type_complexity)]
28
        $(#[$derive])*
29
        pub struct $name <$($typarm),*> where $($bounds)* {
30
            iter: $iter,
31
        }
32
        impl<$($typarm),*> Iterator for $name <$($typarm),*>
33
            where $($bounds)*
34
        {
35
            type Item = $item;
36
            #[inline]
37
0
            fn next(&mut self) -> Option<Self::Item> {
38
0
                self.iter.next()
39
0
            }
Unexecuted instantiation: <petgraph::adj::OutgoingEdgeIndices<_> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <petgraph::adj::EdgeReferences<_, _> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <petgraph::adj::OutgoingEdgeReferences<_, _> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::iterator::Iterator>::next
40
41
            #[inline]
42
0
            fn size_hint(&self) -> (usize, Option<usize>) {
43
0
                self.iter.size_hint()
44
0
            }
Unexecuted instantiation: <petgraph::adj::OutgoingEdgeIndices<_> as core::iter::traits::iterator::Iterator>::size_hint
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::iterator::Iterator>::size_hint
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::iterator::Iterator>::size_hint
Unexecuted instantiation: <petgraph::adj::EdgeReferences<_, _> as core::iter::traits::iterator::Iterator>::size_hint
Unexecuted instantiation: <petgraph::adj::OutgoingEdgeReferences<_, _> as core::iter::traits::iterator::Iterator>::size_hint
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::iterator::Iterator>::size_hint
45
        }
46
        iterator_wrap!(
47
            impl ($($rest)*)  for
48
            struct $name <$($typarm),*> where { $($bounds)* }
49
            item: $item,
50
            iter: $iter,
51
            );
52
        );
53
54
    (
55
impl (ExactSizeIterator $($rest:tt)*)  for
56
    $(#[$derive:meta])*
57
     struct $name: ident <$($typarm:tt),*> where { $($bounds: tt)* }
58
     item: $item: ty,
59
     iter: $iter: ty,
60
     ) => (
61
        impl<$($typarm),*> ExactSizeIterator for $name <$($typarm),*>
62
            where $($bounds)*
63
        {
64
            #[inline]
65
0
            fn len(&self) -> usize {
66
0
                self.iter.len()
67
0
            }
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::exact_size::ExactSizeIterator>::len
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::exact_size::ExactSizeIterator>::len
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::exact_size::ExactSizeIterator>::len
68
        }
69
        iterator_wrap!(
70
            impl ($($rest)*)  for
71
         $(#[$derive])*
72
            struct $name <$($typarm),*> where { $($bounds)* }
73
            item: $item,
74
            iter: $iter,
75
            );
76
    );
77
78
    (
79
impl (DoubleEndedIterator $($rest:tt)*)  for
80
    $(#[$derive:meta])*
81
     struct $name: ident <$($typarm:tt),*> where { $($bounds: tt)* }
82
     item: $item: ty,
83
     iter: $iter: ty,
84
     ) => (
85
        impl<$($typarm),*> DoubleEndedIterator for $name <$($typarm),*>
86
            where $($bounds)*
87
        {
88
0
            fn next_back(&mut self) -> Option<Self::Item> {
89
0
                self.iter.next_back()
90
0
            }
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back
91
0
            fn rfold<B, F>(self, accum: B, f: F) -> B
92
0
                where
93
0
                    F: FnMut(B, Self::Item) -> B,
94
0
                { self.iter.rfold(accum, f) }
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::rfold::<_, _>
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::double_ended::DoubleEndedIterator>::rfold::<_, _>
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::double_ended::DoubleEndedIterator>::rfold::<_, _>
95
0
            fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
96
0
                where
97
0
                    P: FnMut(&Self::Item) -> bool,
98
0
                { self.iter.rfind(predicate) }
Unexecuted instantiation: <petgraph::adj::Neighbors<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::rfind::<_>
Unexecuted instantiation: <petgraph::adj::NodeIndices<_> as core::iter::traits::double_ended::DoubleEndedIterator>::rfind::<_>
Unexecuted instantiation: <petgraph::graphmap::Nodes<_> as core::iter::traits::double_ended::DoubleEndedIterator>::rfind::<_>
99
        }
100
        iterator_wrap!(
101
            impl ($($rest)*)  for
102
         $(#[$derive])*
103
           struct $name <$($typarm),*> where { $($bounds)* }
104
            item: $item,
105
            iter: $iter,
106
            );
107
    );
108
}