Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use crate::events::attributes::Attribute;
use crate::events::{BytesStart, Event};
use std::fmt::{self, Debug, Formatter};
use std::fmt::{self, Debug, Display, Formatter};
use std::iter::FusedIterator;

/// Some namespace was invalid
Expand Down Expand Up @@ -53,7 +53,7 @@ pub enum NamespaceError {
}

impl fmt::Display for NamespaceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
Self::UnknownPrefix(prefix) => {
write!(f, "unknown namespace prefix '{}'", prefix)
Expand Down Expand Up @@ -216,6 +216,14 @@ impl<'a> Debug for QName<'a> {
write!(f, "QName({})", self.0)
}
}

impl<'a> Display for QName<'a> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}

impl<'a> AsRef<str> for QName<'a> {
#[inline]
fn as_ref(&self) -> &str {
Expand Down Expand Up @@ -246,6 +254,12 @@ impl<'a> Debug for LocalName<'a> {
}
}

impl<'a> Display for LocalName<'a> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}
impl<'a> AsRef<str> for LocalName<'a> {
#[inline]
fn as_ref(&self) -> &str {
Expand Down Expand Up @@ -309,6 +323,13 @@ impl<'a> Debug for Prefix<'a> {
}
}

impl<'a> Display for Prefix<'a> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}

impl<'a> AsRef<str> for Prefix<'a> {
#[inline]
fn as_ref(&self) -> &str {
Expand Down Expand Up @@ -386,6 +407,13 @@ impl<'a> Debug for Namespace<'a> {
}
}

impl<'a> Display for Namespace<'a> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}

impl<'a> AsRef<str> for Namespace<'a> {
#[inline]
fn as_ref(&self) -> &str {
Expand Down
Loading