@@ -6,7 +6,7 @@ use crate::encoding::Decoder;
6
6
use crate :: errors:: Result as XmlResult ;
7
7
use crate :: escape:: { escape, resolve_predefined_entity, unescape_with} ;
8
8
use crate :: name:: QName ;
9
- use crate :: utils:: { is_whitespace, write_byte_string , write_cow_string , Bytes } ;
9
+ use crate :: utils:: { is_whitespace, Bytes } ;
10
10
11
11
use std:: fmt:: { self , Debug , Display , Formatter } ;
12
12
use std:: iter:: FusedIterator ;
@@ -100,11 +100,10 @@ impl<'a> Attribute<'a> {
100
100
101
101
impl < ' a > Debug for Attribute < ' a > {
102
102
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 ( )
108
107
}
109
108
}
110
109
@@ -196,7 +195,7 @@ impl<'a> From<Attr<&'a [u8]>> for Attribute<'a> {
196
195
/// The duplicate check can be turned off by calling [`with_checks(false)`].
197
196
///
198
197
/// [`with_checks(false)`]: Self::with_checks
199
- #[ derive( Clone , Debug ) ]
198
+ #[ derive( Clone ) ]
200
199
pub struct Attributes < ' a > {
201
200
/// Slice of `BytesStart` corresponding to attributes
202
201
bytes : & ' a [ u8 ] ,
@@ -236,6 +235,15 @@ impl<'a> Attributes<'a> {
236
235
}
237
236
}
238
237
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
+
239
247
impl < ' a > Iterator for Attributes < ' a > {
240
248
type Item = Result < Attribute < ' a > , AttrError > ;
241
249
0 commit comments