Skip to content

Commit 4c5fb95

Browse files
committed
Better debug implementation for PrefixDeclaration
1 parent f58b754 commit 4c5fb95

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/name.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,26 @@ impl<'a> AsRef<[u8]> for Prefix<'a> {
289289

290290
/// A namespace prefix declaration, `xmlns` or `xmlns:<name>`, as defined in
291291
/// [XML Schema specification](https://www.w3.org/TR/xml-names11/#ns-decl)
292-
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
292+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
293293
pub enum PrefixDeclaration<'a> {
294294
/// XML attribute binds a default namespace. Corresponds to `xmlns` in `xmlns="..."`
295295
Default,
296296
/// XML attribute binds a specified prefix to a namespace. Corresponds to a
297297
/// `prefix` in `xmlns:prefix="..."`, which is stored as payload of this variant.
298298
Named(&'a [u8]),
299299
}
300+
impl<'a> Debug for PrefixDeclaration<'a> {
301+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
302+
match self {
303+
Self::Default => f.write_str("PrefixDeclaration::Default"),
304+
Self::Named(prefix) => {
305+
f.write_str("PrefixDeclaration::Named(")?;
306+
write_byte_string(f, prefix)?;
307+
f.write_str(")")
308+
}
309+
}
310+
}
311+
}
300312

301313
////////////////////////////////////////////////////////////////////////////////////////////////////
302314

0 commit comments

Comments
 (0)