2121use std:: {
2222 cmp:: max,
2323 collections:: { BTreeSet , HashMap , HashSet } ,
24- fmt:: Debug ,
24+ fmt:: { self , Debug } ,
2525} ;
2626
2727use libp2p_core:: PeerId ;
@@ -655,7 +655,7 @@ pub(crate) enum ReceivedAction {
655655}
656656
657657/// A Partial message sent and received from remote peers.
658- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
658+ #[ derive( Clone , PartialEq , Eq , Hash ) ]
659659pub struct PartialMessage {
660660 /// The group ID that identifies the complete logical message.
661661 pub group_id : Vec < u8 > ,
@@ -667,6 +667,20 @@ pub struct PartialMessage {
667667 pub metadata : Option < Vec < u8 > > ,
668668}
669669
670+ impl Debug for PartialMessage {
671+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
672+ f. debug_struct ( "PartialMessage" )
673+ . field ( "group_id" , & self . group_id )
674+ . field ( "topic_hash" , & self . topic_hash )
675+ . field (
676+ "body length" ,
677+ & self . body . as_ref ( ) . map ( |body| body. len ( ) ) . unwrap_or ( 0 ) ,
678+ )
679+ . field ( "metadata" , & self . metadata )
680+ . finish ( )
681+ }
682+ }
683+
670684/// Stored `Metadata` for a peer,
671685/// `Remote` or `Local` depends on who last updated it.
672686#[ derive( Debug ) ]
0 commit comments