@@ -6,7 +6,7 @@ use crate::encoding::Decoder;
66use crate :: errors:: Result as XmlResult ;
77use crate :: escape:: { escape, resolve_predefined_entity, unescape_with} ;
88use crate :: name:: QName ;
9- use crate :: utils:: { is_whitespace, write_byte_string , write_cow_string , Bytes } ;
9+ use crate :: utils:: { is_whitespace, Bytes } ;
1010
1111use std:: fmt:: { self , Debug , Display , Formatter } ;
1212use std:: iter:: FusedIterator ;
@@ -100,11 +100,10 @@ impl<'a> Attribute<'a> {
100100
101101impl < ' a > Debug for Attribute < ' a > {
102102 fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
103- write ! ( f, "Attribute {{ key: " ) ?;
104- write_byte_string ( f, self . key . as_ref ( ) ) ?;
105- write ! ( f, ", value: " ) ?;
106- write_cow_string ( f, & self . value ) ?;
107- write ! ( f, " }}" )
103+ f. debug_struct ( "Attribute" )
104+ . field ( "key" , & Bytes ( self . key . as_ref ( ) ) )
105+ . field ( "value" , & Bytes ( & self . value ) )
106+ . finish ( )
108107 }
109108}
110109
@@ -196,7 +195,7 @@ impl<'a> From<Attr<&'a [u8]>> for Attribute<'a> {
196195/// The duplicate check can be turned off by calling [`with_checks(false)`].
197196///
198197/// [`with_checks(false)`]: Self::with_checks
199- #[ derive( Clone , Debug ) ]
198+ #[ derive( Clone ) ]
200199pub struct Attributes < ' a > {
201200 /// Slice of `BytesStart` corresponding to attributes
202201 bytes : & ' a [ u8 ] ,
@@ -236,6 +235,15 @@ impl<'a> Attributes<'a> {
236235 }
237236}
238237
238+ impl < ' a > Debug for Attributes < ' a > {
239+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
240+ f. debug_struct ( "Attributes" )
241+ . field ( "bytes" , & Bytes ( & self . bytes ) )
242+ . field ( "state" , & self . state )
243+ . finish ( )
244+ }
245+ }
246+
239247impl < ' a > Iterator for Attributes < ' a > {
240248 type Item = Result < Attribute < ' a > , AttrError > ;
241249
0 commit comments