@@ -2024,6 +2024,32 @@ impl<A> &[A]: iter::BaseIter<A> {
2024
2024
pure fn size_hint ( & self ) -> Option < uint > { Some ( len ( * self ) ) }
2025
2025
}
2026
2026
2027
+ // FIXME(#4148): This should be redundant
2028
+ impl < A > ~[ A ] : iter:: BaseIter < A > {
2029
+ pub pure fn each ( & self , blk : fn ( v : & A ) -> bool ) {
2030
+ // FIXME(#2263)---should be able to call each(self, blk)
2031
+ for each( * self ) |e| {
2032
+ if ( !blk ( e) ) {
2033
+ return ;
2034
+ }
2035
+ }
2036
+ }
2037
+ pure fn size_hint ( & self ) -> Option < uint > { Some ( len ( * self ) ) }
2038
+ }
2039
+
2040
+ // FIXME(#4148): This should be redundant
2041
+ impl < A > @[ A ] : iter:: BaseIter < A > {
2042
+ pub pure fn each ( & self , blk : fn ( v : & A ) -> bool ) {
2043
+ // FIXME(#2263)---should be able to call each(self, blk)
2044
+ for each( * self ) |e| {
2045
+ if ( !blk ( e) ) {
2046
+ return ;
2047
+ }
2048
+ }
2049
+ }
2050
+ pure fn size_hint ( & self ) -> Option < uint > { Some ( len ( * self ) ) }
2051
+ }
2052
+
2027
2053
impl < A > & [ A ] : iter:: ExtendedIter < A > {
2028
2054
pub pure fn eachi ( & self , blk : fn ( uint , v : & A ) -> bool ) {
2029
2055
iter:: eachi ( self , blk)
@@ -2049,11 +2075,75 @@ impl<A> &[A]: iter::ExtendedIter<A> {
2049
2075
}
2050
2076
}
2051
2077
2078
+ // FIXME(#4148): This should be redundant
2079
+ impl < A > ~[ A ] : iter:: ExtendedIter < A > {
2080
+ pub pure fn eachi ( & self , blk : fn ( uint , v : & A ) -> bool ) {
2081
+ iter:: eachi ( self , blk)
2082
+ }
2083
+ pub pure fn all ( & self , blk : fn ( & A ) -> bool ) -> bool {
2084
+ iter:: all ( self , blk)
2085
+ }
2086
+ pub pure fn any ( & self , blk : fn ( & A ) -> bool ) -> bool {
2087
+ iter:: any ( self , blk)
2088
+ }
2089
+ pub pure fn foldl < B > ( & self , b0 : B , blk : fn ( & B , & A ) -> B ) -> B {
2090
+ iter:: foldl ( self , b0, blk)
2091
+ }
2092
+ pub pure fn position ( & self , f : fn ( & A ) -> bool ) -> Option < uint > {
2093
+ iter:: position ( self , f)
2094
+ }
2095
+ pure fn map_to_vec < B > ( & self , op : fn ( & A ) -> B ) -> ~[ B ] {
2096
+ iter:: map_to_vec ( self , op)
2097
+ }
2098
+ pure fn flat_map_to_vec < B , IB : BaseIter < B > > ( & self , op : fn ( & A ) -> IB )
2099
+ -> ~[ B ] {
2100
+ iter:: flat_map_to_vec ( self , op)
2101
+ }
2102
+ }
2103
+
2104
+ // FIXME(#4148): This should be redundant
2105
+ impl < A > @[ A ] : iter:: ExtendedIter < A > {
2106
+ pub pure fn eachi ( & self , blk : fn ( uint , v : & A ) -> bool ) {
2107
+ iter:: eachi ( self , blk)
2108
+ }
2109
+ pub pure fn all ( & self , blk : fn ( & A ) -> bool ) -> bool {
2110
+ iter:: all ( self , blk)
2111
+ }
2112
+ pub pure fn any ( & self , blk : fn ( & A ) -> bool ) -> bool {
2113
+ iter:: any ( self , blk)
2114
+ }
2115
+ pub pure fn foldl < B > ( & self , b0 : B , blk : fn ( & B , & A ) -> B ) -> B {
2116
+ iter:: foldl ( self , b0, blk)
2117
+ }
2118
+ pub pure fn position ( & self , f : fn ( & A ) -> bool ) -> Option < uint > {
2119
+ iter:: position ( self , f)
2120
+ }
2121
+ pure fn map_to_vec < B > ( & self , op : fn ( & A ) -> B ) -> ~[ B ] {
2122
+ iter:: map_to_vec ( self , op)
2123
+ }
2124
+ pure fn flat_map_to_vec < B , IB : BaseIter < B > > ( & self , op : fn ( & A ) -> IB )
2125
+ -> ~[ B ] {
2126
+ iter:: flat_map_to_vec ( self , op)
2127
+ }
2128
+ }
2129
+
2052
2130
impl < A : Eq > & [ A ] : iter:: EqIter < A > {
2053
2131
pub pure fn contains ( & self , x : & A ) -> bool { iter:: contains ( self , x) }
2054
2132
pub pure fn count ( & self , x : & A ) -> uint { iter:: count ( self , x) }
2055
2133
}
2056
2134
2135
+ // FIXME(#4148): This should be redundant
2136
+ impl < A : Eq > ~[ A ] : iter:: EqIter < A > {
2137
+ pub pure fn contains ( & self , x : & A ) -> bool { iter:: contains ( self , x) }
2138
+ pub pure fn count ( & self , x : & A ) -> uint { iter:: count ( self , x) }
2139
+ }
2140
+
2141
+ // FIXME(#4148): This should be redundant
2142
+ impl < A : Eq > @[ A ] : iter:: EqIter < A > {
2143
+ pub pure fn contains ( & self , x : & A ) -> bool { iter:: contains ( self , x) }
2144
+ pub pure fn count ( & self , x : & A ) -> uint { iter:: count ( self , x) }
2145
+ }
2146
+
2057
2147
impl < A : Copy > & [ A ] : iter:: CopyableIter < A > {
2058
2148
pure fn filter_to_vec ( & self , pred : fn ( & A ) -> bool ) -> ~[ A ] {
2059
2149
iter:: filter_to_vec ( self , pred)
@@ -2064,11 +2154,45 @@ impl<A: Copy> &[A]: iter::CopyableIter<A> {
2064
2154
}
2065
2155
}
2066
2156
2157
+ // FIXME(#4148): This should be redundant
2158
+ impl < A : Copy > ~[ A ] : iter:: CopyableIter < A > {
2159
+ pure fn filter_to_vec ( & self , pred : fn ( & A ) -> bool ) -> ~[ A ] {
2160
+ iter:: filter_to_vec ( self , pred)
2161
+ }
2162
+ pure fn to_vec ( & self ) -> ~[ A ] { iter:: to_vec ( self ) }
2163
+ pub pure fn find ( & self , f : fn ( & A ) -> bool ) -> Option < A > {
2164
+ iter:: find ( self , f)
2165
+ }
2166
+ }
2167
+
2168
+ // FIXME(#4148): This should be redundant
2169
+ impl < A : Copy > @[ A ] : iter:: CopyableIter < A > {
2170
+ pure fn filter_to_vec ( & self , pred : fn ( & A ) -> bool ) -> ~[ A ] {
2171
+ iter:: filter_to_vec ( self , pred)
2172
+ }
2173
+ pure fn to_vec ( & self ) -> ~[ A ] { iter:: to_vec ( self ) }
2174
+ pub pure fn find ( & self , f : fn ( & A ) -> bool ) -> Option < A > {
2175
+ iter:: find ( self , f)
2176
+ }
2177
+ }
2178
+
2067
2179
impl < A : Copy Ord > & [ A ] : iter:: CopyableOrderedIter < A > {
2068
2180
pure fn min ( & self ) -> A { iter:: min ( self ) }
2069
2181
pure fn max ( & self ) -> A { iter:: max ( self ) }
2070
2182
}
2071
2183
2184
+ // FIXME(#4148): This should be redundant
2185
+ impl < A : Copy Ord > ~[ A ] : iter:: CopyableOrderedIter < A > {
2186
+ pure fn min ( & self ) -> A { iter:: min ( self ) }
2187
+ pure fn max ( & self ) -> A { iter:: max ( self ) }
2188
+ }
2189
+
2190
+ // FIXME(#4148): This should be redundant
2191
+ impl < A : Copy Ord > @[ A ] : iter:: CopyableOrderedIter < A > {
2192
+ pure fn min ( & self ) -> A { iter:: min ( self ) }
2193
+ pure fn max ( & self ) -> A { iter:: max ( self ) }
2194
+ }
2195
+
2072
2196
impl < A : Copy > & [ A ] : iter:: CopyableNonstrictIter < A > {
2073
2197
pure fn each_val ( & const self , f : fn ( A ) -> bool ) {
2074
2198
let mut i = 0 ;
@@ -2079,6 +2203,7 @@ impl<A:Copy> &[A] : iter::CopyableNonstrictIter<A> {
2079
2203
}
2080
2204
}
2081
2205
2206
+ // FIXME(#4148): This should be redundant
2082
2207
impl < A : Copy > ~[ A ] : iter:: CopyableNonstrictIter < A > {
2083
2208
pure fn each_val ( & const self , f : fn ( A ) -> bool ) {
2084
2209
let mut i = 0 ;
@@ -2089,6 +2214,7 @@ impl<A:Copy> ~[A] : iter::CopyableNonstrictIter<A> {
2089
2214
}
2090
2215
}
2091
2216
2217
+ // FIXME(#4148): This should be redundant
2092
2218
impl < A : Copy > @[ A ] : iter:: CopyableNonstrictIter < A > {
2093
2219
pure fn each_val ( & const self , f : fn ( A ) -> bool ) {
2094
2220
let mut i = 0 ;
0 commit comments