11//! An order-preserving immutable map constructed at compile time.
22use core:: fmt;
3+ use core:: iter:: FusedIterator ;
34use core:: iter:: IntoIterator ;
45use core:: ops:: Index ;
56use core:: slice;
@@ -179,6 +180,25 @@ pub struct Entries<'a, K, V> {
179180 iter : slice:: Iter < ' a , ( K , V ) > ,
180181}
181182
183+ impl < ' a , K , V > Clone for Entries < ' a , K , V > {
184+ #[ inline]
185+ fn clone ( & self ) -> Self {
186+ Self {
187+ iter : self . iter . clone ( ) ,
188+ }
189+ }
190+ }
191+
192+ impl < ' a , K , V > fmt:: Debug for Entries < ' a , K , V >
193+ where
194+ K : fmt:: Debug ,
195+ V : fmt:: Debug ,
196+ {
197+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
198+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
199+ }
200+ }
201+
182202impl < ' a , K , V > Iterator for Entries < ' a , K , V > {
183203 type Item = ( & ' a K , & ' a V ) ;
184204
@@ -199,11 +219,31 @@ impl<'a, K, V> DoubleEndedIterator for Entries<'a, K, V> {
199219
200220impl < ' a , K , V > ExactSizeIterator for Entries < ' a , K , V > { }
201221
222+ impl < ' a , K , V > FusedIterator for Entries < ' a , K , V > { }
223+
202224/// An iterator over the keys in a `OrderedMap`.
203225pub struct Keys < ' a , K , V > {
204226 iter : Entries < ' a , K , V > ,
205227}
206228
229+ impl < ' a , K , V > Clone for Keys < ' a , K , V > {
230+ #[ inline]
231+ fn clone ( & self ) -> Self {
232+ Self {
233+ iter : self . iter . clone ( ) ,
234+ }
235+ }
236+ }
237+
238+ impl < ' a , K , V > fmt:: Debug for Keys < ' a , K , V >
239+ where
240+ K : fmt:: Debug ,
241+ {
242+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
243+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
244+ }
245+ }
246+
207247impl < ' a , K , V > Iterator for Keys < ' a , K , V > {
208248 type Item = & ' a K ;
209249
@@ -224,11 +264,31 @@ impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
224264
225265impl < ' a , K , V > ExactSizeIterator for Keys < ' a , K , V > { }
226266
267+ impl < ' a , K , V > FusedIterator for Keys < ' a , K , V > { }
268+
227269/// An iterator over the values in a `OrderedMap`.
228270pub struct Values < ' a , K , V > {
229271 iter : Entries < ' a , K , V > ,
230272}
231273
274+ impl < ' a , K , V > Clone for Values < ' a , K , V > {
275+ #[ inline]
276+ fn clone ( & self ) -> Self {
277+ Self {
278+ iter : self . iter . clone ( ) ,
279+ }
280+ }
281+ }
282+
283+ impl < ' a , K , V > fmt:: Debug for Values < ' a , K , V >
284+ where
285+ V : fmt:: Debug ,
286+ {
287+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
288+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
289+ }
290+ }
291+
232292impl < ' a , K , V > Iterator for Values < ' a , K , V > {
233293 type Item = & ' a V ;
234294
@@ -248,3 +308,5 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
248308}
249309
250310impl < ' a , K , V > ExactSizeIterator for Values < ' a , K , V > { }
311+
312+ impl < ' a , K , V > FusedIterator for Values < ' a , K , V > { }
0 commit comments