@@ -2135,23 +2135,19 @@ macro_rules! double_ended_iterator {
2135
2135
}
2136
2136
}
2137
2137
2138
- macro_rules! random_access_iterator {
2139
- ( impl $name: ident -> $elem: ty) => {
2140
- impl <' self , T > RandomAccessIterator <$elem> for $name<' self , T > {
2141
- #[ inline]
2142
- fn indexable( & self ) -> uint {
2143
- let ( exact, _) = self . size_hint( ) ;
2144
- exact
2145
- }
2138
+ impl < ' self , T > RandomAccessIterator < & ' self T > for VecIterator < ' self , T > {
2139
+ #[ inline]
2140
+ fn indexable ( & self ) -> uint {
2141
+ let ( exact, _) = self . size_hint ( ) ;
2142
+ exact
2143
+ }
2146
2144
2147
- fn idx( & self , index: uint) -> Option <$elem> {
2148
- unsafe {
2149
- if index < self . indexable( ) {
2150
- cast:: transmute( self . ptr. offset( index) )
2151
- } else {
2152
- None
2153
- }
2154
- }
2145
+ fn idx ( & self , index : uint ) -> Option < & ' self T > {
2146
+ unsafe {
2147
+ if index < self . indexable ( ) {
2148
+ cast:: transmute ( self . ptr . offset ( index) )
2149
+ } else {
2150
+ None
2155
2151
}
2156
2152
}
2157
2153
}
@@ -2166,7 +2162,6 @@ pub struct VecIterator<'self, T> {
2166
2162
}
2167
2163
iterator ! { impl VecIterator -> & ' self T }
2168
2164
double_ended_iterator ! { impl VecIterator -> & ' self T }
2169
- random_access_iterator ! { impl VecIterator -> & ' self T }
2170
2165
pub type RevIterator < ' self , T > = Invert < VecIterator < ' self , T > > ;
2171
2166
2172
2167
impl < ' self , T > Clone for VecIterator < ' self , T > {
0 commit comments