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