Add some fmt::Debug implementations

This commit is contained in:
Simon Sapin 2016-08-08 15:52:24 +02:00
parent 477cae67df
commit bc71e8b65b
7 changed files with 59 additions and 4 deletions

View file

@ -79,6 +79,7 @@ use std::borrow::Cow;
use std::cell::{Cell, Ref};
use std::convert::TryFrom;
use std::default::Default;
use std::fmt;
use std::mem;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
@ -115,6 +116,16 @@ pub struct Element {
atomic_flags: AtomicElementFlags,
}
impl fmt::Debug for Element {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "<{}", self.local_name));
if let Some(ref id) = *self.id_attribute.borrow() {
try!(write!(f, " id={}", id));
}
write!(f, ">")
}
}
#[derive(PartialEq, HeapSizeOf)]
pub enum ElementCreator {
ParserCreated,