@@ -2,6 +2,7 @@ use crate::{inner::Inner, values::Values};
22use left_right:: ReadGuard ;
33use std:: borrow:: Borrow ;
44use std:: collections:: hash_map:: RandomState ;
5+ use std:: fmt;
56use std:: hash:: { BuildHasher , Hash } ;
67
78// To make [`WriteHandle`] and friends work.
@@ -15,7 +16,6 @@ use crate::WriteHandle;
1516///
1617/// Since the map remains immutable while this lives, the methods on this type all give you
1718/// unguarded references to types contained in the map.
18- #[ derive( Debug ) ]
1919pub struct MapReadRef < ' rh , K , V , M = ( ) , S = RandomState >
2020where
2121 K : Hash + Eq ,
2525 pub ( super ) guard : ReadGuard < ' rh , Inner < K , V , M , S > > ,
2626}
2727
28+ impl < ' rh , K , V , M , S > fmt:: Debug for MapReadRef < ' rh , K , V , M , S >
29+ where
30+ K : Hash + Eq ,
31+ V : Eq + Hash ,
32+ S : BuildHasher ,
33+ K : fmt:: Debug ,
34+ M : fmt:: Debug ,
35+ V : fmt:: Debug ,
36+ {
37+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
38+ f. debug_struct ( "MapReadRef" )
39+ . field ( "guard" , & self . guard )
40+ . finish ( )
41+ }
42+ }
43+
2844impl < ' rh , K , V , M , S > MapReadRef < ' rh , K , V , M , S >
2945where
3046 K : Hash + Eq ,
@@ -169,7 +185,6 @@ where
169185}
170186
171187/// An [`Iterator`] over keys and values in the evmap.
172- #[ derive( Debug ) ]
173188pub struct ReadGuardIter < ' rg , K , V , S >
174189where
175190 K : Eq + Hash ,
@@ -179,6 +194,18 @@ where
179194 iter : <& ' rg crate :: inner:: MapImpl < K , Values < V , S > , S > as IntoIterator >:: IntoIter ,
180195}
181196
197+ impl < ' rg , K , V , S > fmt:: Debug for ReadGuardIter < ' rg , K , V , S >
198+ where
199+ K : Eq + Hash + fmt:: Debug ,
200+ V : Eq + Hash ,
201+ S : BuildHasher ,
202+ V : fmt:: Debug ,
203+ {
204+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
205+ f. debug_tuple ( "ReadGuardIter" ) . field ( & self . iter ) . finish ( )
206+ }
207+ }
208+
182209impl < ' rg , K , V , S > Iterator for ReadGuardIter < ' rg , K , V , S >
183210where
184211 K : Eq + Hash ,
@@ -192,7 +219,6 @@ where
192219}
193220
194221/// An [`Iterator`] over keys.
195- #[ derive( Debug ) ]
196222pub struct KeysIter < ' rg , K , V , S >
197223where
198224 K : Eq + Hash ,
@@ -202,6 +228,18 @@ where
202228 iter : <& ' rg crate :: inner:: MapImpl < K , Values < V , S > , S > as IntoIterator >:: IntoIter ,
203229}
204230
231+ impl < ' rg , K , V , S > fmt:: Debug for KeysIter < ' rg , K , V , S >
232+ where
233+ K : Eq + Hash + fmt:: Debug ,
234+ V : Eq + Hash ,
235+ S : BuildHasher ,
236+ V : fmt:: Debug ,
237+ {
238+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
239+ f. debug_tuple ( "KeysIter" ) . field ( & self . iter ) . finish ( )
240+ }
241+ }
242+
205243impl < ' rg , K , V , S > Iterator for KeysIter < ' rg , K , V , S >
206244where
207245 K : Eq + Hash ,
@@ -215,7 +253,6 @@ where
215253}
216254
217255/// An [`Iterator`] over value sets.
218- #[ derive( Debug ) ]
219256pub struct ValuesIter < ' rg , K , V , S >
220257where
221258 K : Eq + Hash ,
@@ -225,6 +262,18 @@ where
225262 iter : <& ' rg crate :: inner:: MapImpl < K , Values < V , S > , S > as IntoIterator >:: IntoIter ,
226263}
227264
265+ impl < ' rg , K , V , S > fmt:: Debug for ValuesIter < ' rg , K , V , S >
266+ where
267+ K : Eq + Hash + fmt:: Debug ,
268+ V : Eq + Hash ,
269+ S : BuildHasher ,
270+ V : fmt:: Debug ,
271+ {
272+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
273+ f. debug_tuple ( "ValuesIter" ) . field ( & self . iter ) . finish ( )
274+ }
275+ }
276+
228277impl < ' rg , K , V , S > Iterator for ValuesIter < ' rg , K , V , S >
229278where
230279 K : Eq + Hash ,
0 commit comments