-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
iterator.expanded.rs
127 lines (127 loc) · 4.18 KB
/
iterator.expanded.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
use iter_enum::*;
enum Enum<A, B> {
A(A),
B(B),
}
impl<A, B> ::core::iter::Iterator for Enum<A, B>
where
A: ::core::iter::Iterator,
B: ::core::iter::Iterator<Item = <A as ::core::iter::Iterator>::Item>,
{
type Item = <A as ::core::iter::Iterator>::Item;
#[inline]
fn next(&mut self) -> ::core::option::Option<Self::Item> {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::next(x),
Enum::B(x) => <B as ::core::iter::Iterator>::next(x),
}
}
#[inline]
fn size_hint(&self) -> (usize, ::core::option::Option<usize>) {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::size_hint(x),
Enum::B(x) => <B as ::core::iter::Iterator>::size_hint(x),
}
}
#[inline]
fn count(self) -> usize {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::count(x),
Enum::B(x) => <B as ::core::iter::Iterator>::count(x),
}
}
#[inline]
fn last(self) -> ::core::option::Option<Self::Item> {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::last(x),
Enum::B(x) => <B as ::core::iter::Iterator>::last(x),
}
}
#[inline]
fn nth(&mut self, n: usize) -> ::core::option::Option<Self::Item> {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::nth(x, n),
Enum::B(x) => <B as ::core::iter::Iterator>::nth(x, n),
}
}
#[inline]
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
fn collect<__U: ::core::iter::FromIterator<Self::Item>>(self) -> __U {
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::collect(x),
Enum::B(x) => <B as ::core::iter::Iterator>::collect(x),
}
}
#[inline]
fn partition<__U, __F>(self, f: __F) -> (__U, __U)
where
__U: ::core::default::Default + ::core::iter::Extend<Self::Item>,
__F: ::core::ops::FnMut(&Self::Item) -> bool,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::partition(x, f),
Enum::B(x) => <B as ::core::iter::Iterator>::partition(x, f),
}
}
#[inline]
fn fold<__U, __F>(self, init: __U, f: __F) -> __U
where
__F: ::core::ops::FnMut(__U, Self::Item) -> __U,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::fold(x, init, f),
Enum::B(x) => <B as ::core::iter::Iterator>::fold(x, init, f),
}
}
#[inline]
fn all<__F>(&mut self, f: __F) -> bool
where
__F: ::core::ops::FnMut(Self::Item) -> bool,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::all(x, f),
Enum::B(x) => <B as ::core::iter::Iterator>::all(x, f),
}
}
#[inline]
fn any<__F>(&mut self, f: __F) -> bool
where
__F: ::core::ops::FnMut(Self::Item) -> bool,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::any(x, f),
Enum::B(x) => <B as ::core::iter::Iterator>::any(x, f),
}
}
#[inline]
fn find<__P>(&mut self, predicate: __P) -> ::core::option::Option<Self::Item>
where
__P: ::core::ops::FnMut(&Self::Item) -> bool,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::find(x, predicate),
Enum::B(x) => <B as ::core::iter::Iterator>::find(x, predicate),
}
}
#[inline]
fn find_map<__U, __F>(&mut self, f: __F) -> ::core::option::Option<__U>
where
__F: ::core::ops::FnMut(Self::Item) -> ::core::option::Option<__U>,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::find_map(x, f),
Enum::B(x) => <B as ::core::iter::Iterator>::find_map(x, f),
}
}
#[inline]
fn position<__P>(&mut self, predicate: __P) -> ::core::option::Option<usize>
where
__P: ::core::ops::FnMut(Self::Item) -> bool,
{
match self {
Enum::A(x) => <A as ::core::iter::Iterator>::position(x, predicate),
Enum::B(x) => <B as ::core::iter::Iterator>::position(x, predicate),
}
}
}
fn main() {}