Skip to content

Commit 20a0fe9

Browse files
author
bors-servo
authored
Auto merge of #364 - jimblandy:rcdom-debug, r=jdm
markup5ever: Implement Debug for BufferQueue, Node, NodeData.
2 parents 2edfe08 + f5947d9 commit 20a0fe9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

markup5ever/rcdom.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use std::borrow::Cow;
4040
use std::cell::{Cell, RefCell};
4141
use std::collections::HashSet;
4242
use std::default::Default;
43+
use std::fmt;
4344
use std::io;
4445
use std::mem;
4546
use std::rc::{Rc, Weak};
@@ -56,6 +57,7 @@ use ExpandedName;
5657
use QualName;
5758

5859
/// The different kinds of nodes in the DOM.
60+
#[derive(Debug)]
5961
pub enum NodeData {
6062
/// The `Document` itself - the root node of a HTML document.
6163
Document,
@@ -120,6 +122,15 @@ impl Node {
120122
}
121123
}
122124

125+
impl fmt::Debug for Node {
126+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
127+
fmt.debug_struct("Node")
128+
.field("data", &self.data)
129+
.field("children", &self.children)
130+
.finish()
131+
}
132+
}
133+
123134
/// Reference to a DOM node.
124135
pub type Handle = Rc<Node>;
125136

markup5ever/util/buffer_queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub enum SetResult {
4343
/// Internally it uses [`VecDeque`] and has the same complexity properties.
4444
///
4545
/// [`VecDeque`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html
46+
#[derive(Debug)]
4647
pub struct BufferQueue {
4748
/// Buffers to process.
4849
buffers: VecDeque<StrTendril>,

0 commit comments

Comments
 (0)