@@ -5,6 +5,7 @@ use crate::iter::{IntoIter, Iter, IterMut};
55use crate :: keys:: Keys ;
66use alloc:: boxed:: Box ;
77use alloc:: vec:: Vec ;
8+ use core:: fmt;
89use core:: marker:: PhantomData ;
910use core:: mem;
1011use core:: ops:: { Index , IndexMut } ;
@@ -27,7 +28,7 @@ use serde_derive::{Deserialize, Serialize};
2728/// that it only allows indexing with the distinct `EntityRef` key type, so converting to a
2829/// plain slice would make it easier to use incorrectly. To make a slice of a `PrimaryMap`, use
2930/// `into_boxed_slice`.
30- #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
31+ #[ derive( Clone , Hash , PartialEq , Eq ) ]
3132#[ cfg_attr( feature = "enable-serde" , derive( Serialize , Deserialize ) ) ]
3233pub struct PrimaryMap < K , V >
3334where
@@ -336,6 +337,16 @@ where
336337 }
337338}
338339
340+ impl < K : EntityRef + fmt:: Debug , V : fmt:: Debug > fmt:: Debug for PrimaryMap < K , V > {
341+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
342+ let mut struct_ = f. debug_struct ( "PrimaryMap" ) ;
343+ for ( k, v) in self {
344+ struct_. field ( & alloc:: format!( "{k:?}" ) , v) ;
345+ }
346+ struct_. finish ( )
347+ }
348+ }
349+
339350#[ cfg( test) ]
340351mod tests {
341352 use super :: * ;
0 commit comments