@@ -2071,6 +2071,8 @@ pub trait ImmutableVector<'self, T> {
2071
2071
fn initn ( & self , n : uint ) -> & ' self [ T ] ;
2072
2072
fn last ( & self ) -> & ' self T ;
2073
2073
fn last_opt ( & self ) -> Option < & ' self T > ;
2074
+ fn position ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > ;
2075
+ fn rposition ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > ;
2074
2076
#[ cfg( stage0) ]
2075
2077
fn each_reverse ( & self , blk : & fn ( & T ) -> bool ) ;
2076
2078
#[ cfg( not( stage0) ) ]
@@ -2138,6 +2140,30 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
2138
2140
#[ inline]
2139
2141
fn last_opt ( & self ) -> Option < & ' self T > { last_opt ( * self ) }
2140
2142
2143
+ /**
2144
+ * Find the first index matching some predicate
2145
+ *
2146
+ * Apply function `f` to each element of `v`. When function `f` returns
2147
+ * true then an option containing the index is returned. If `f` matches no
2148
+ * elements then none is returned.
2149
+ */
2150
+ #[ inline]
2151
+ fn position ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > {
2152
+ position ( * self , f)
2153
+ }
2154
+
2155
+ /**
2156
+ * Find the last index matching some predicate
2157
+ *
2158
+ * Apply function `f` to each element of `v` in reverse order. When
2159
+ * function `f` returns true then an option containing the index is
2160
+ * returned. If `f` matches no elements then none is returned.
2161
+ */
2162
+ #[ inline]
2163
+ fn rposition ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > {
2164
+ rposition ( * self , f)
2165
+ }
2166
+
2141
2167
/// Iterates over a vector's elements in reverse.
2142
2168
#[ inline]
2143
2169
#[ cfg( stage0) ]
@@ -2230,43 +2256,17 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
2230
2256
}
2231
2257
2232
2258
pub trait ImmutableEqVector < T : Eq > {
2233
- fn position ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > ;
2234
2259
fn position_elem ( & self , t : & T ) -> Option < uint > ;
2235
- fn rposition ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > ;
2236
2260
fn rposition_elem ( & self , t : & T ) -> Option < uint > ;
2237
2261
}
2238
2262
2239
2263
impl < ' self , T : Eq > ImmutableEqVector < T > for & ' self [ T ] {
2240
- /**
2241
- * Find the first index matching some predicate
2242
- *
2243
- * Apply function `f` to each element of `v`. When function `f` returns
2244
- * true then an option containing the index is returned. If `f` matches no
2245
- * elements then none is returned.
2246
- */
2247
- #[ inline]
2248
- fn position ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > {
2249
- position ( * self , f)
2250
- }
2251
-
2252
2264
/// Find the first index containing a matching value
2253
2265
#[ inline]
2254
2266
fn position_elem ( & self , x : & T ) -> Option < uint > {
2255
2267
position_elem ( * self , x)
2256
2268
}
2257
2269
2258
- /**
2259
- * Find the last index matching some predicate
2260
- *
2261
- * Apply function `f` to each element of `v` in reverse order. When
2262
- * function `f` returns true then an option containing the index is
2263
- * returned. If `f` matches no elements then none is returned.
2264
- */
2265
- #[ inline]
2266
- fn rposition ( & self , f : & fn ( t : & T ) -> bool ) -> Option < uint > {
2267
- rposition ( * self , f)
2268
- }
2269
-
2270
2270
/// Find the last index containing a matching value
2271
2271
#[ inline]
2272
2272
fn rposition_elem ( & self , t : & T ) -> Option < uint > {
0 commit comments