@@ -169,51 +169,37 @@ impl<K, V> Slice<K, V> {
169
169
170
170
/// Return an iterator over the key-value pairs of the map slice.
171
171
pub fn iter ( & self ) -> Iter < ' _ , K , V > {
172
- Iter {
173
- iter : self . entries . iter ( ) ,
174
- }
172
+ Iter :: new ( & self . entries )
175
173
}
176
174
177
175
/// Return an iterator over the key-value pairs of the map slice.
178
176
pub fn iter_mut ( & mut self ) -> IterMut < ' _ , K , V > {
179
- IterMut {
180
- iter : self . entries . iter_mut ( ) ,
181
- }
177
+ IterMut :: new ( & mut self . entries )
182
178
}
183
179
184
180
/// Return an iterator over the keys of the map slice.
185
181
pub fn keys ( & self ) -> Keys < ' _ , K , V > {
186
- Keys {
187
- iter : self . entries . iter ( ) ,
188
- }
182
+ Keys :: new ( & self . entries )
189
183
}
190
184
191
185
/// Return an owning iterator over the keys of the map slice.
192
186
pub fn into_keys ( self : Box < Self > ) -> IntoKeys < K , V > {
193
- IntoKeys {
194
- iter : self . into_entries ( ) . into_iter ( ) ,
195
- }
187
+ IntoKeys :: new ( self . into_entries ( ) )
196
188
}
197
189
198
190
/// Return an iterator over the values of the map slice.
199
191
pub fn values ( & self ) -> Values < ' _ , K , V > {
200
- Values {
201
- iter : self . entries . iter ( ) ,
202
- }
192
+ Values :: new ( & self . entries )
203
193
}
204
194
205
195
/// Return an iterator over mutable references to the the values of the map slice.
206
196
pub fn values_mut ( & mut self ) -> ValuesMut < ' _ , K , V > {
207
- ValuesMut {
208
- iter : self . entries . iter_mut ( ) ,
209
- }
197
+ ValuesMut :: new ( & mut self . entries )
210
198
}
211
199
212
200
/// Return an owning iterator over the values of the map slice.
213
201
pub fn into_values ( self : Box < Self > ) -> IntoValues < K , V > {
214
- IntoValues {
215
- iter : self . into_entries ( ) . into_iter ( ) ,
216
- }
202
+ IntoValues :: new ( self . into_entries ( ) )
217
203
}
218
204
}
219
205
@@ -240,9 +226,7 @@ impl<K, V> IntoIterator for Box<Slice<K, V>> {
240
226
type Item = ( K , V ) ;
241
227
242
228
fn into_iter ( self ) -> Self :: IntoIter {
243
- IntoIter {
244
- iter : self . into_entries ( ) . into_iter ( ) ,
245
- }
229
+ IntoIter :: new ( self . into_entries ( ) )
246
230
}
247
231
}
248
232
0 commit comments