summaryrefslogtreecommitdiff
path: root/src/layout/par.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-09-26 12:24:24 +0200
committerLaurenz <laurmaedje@gmail.com>2021-09-26 12:24:24 +0200
commita493b9533a894b23fd33b307495919faee1c4a14 (patch)
tree8f0a5ec91a7236376af3b2267680a22adb924e57 /src/layout/par.rs
parent72eb243e269fc74c9e59341e384ec3667c7848bf (diff)
More useful `Debug` impls
Diffstat (limited to 'src/layout/par.rs')
-rw-r--r--src/layout/par.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/layout/par.rs b/src/layout/par.rs
index 18a701cd..c8ced2f8 100644
--- a/src/layout/par.rs
+++ b/src/layout/par.rs
@@ -1,3 +1,4 @@
+use std::fmt::{self, Debug, Formatter};
use std::rc::Rc;
use unicode_bidi::{BidiInfo, Level};
@@ -22,7 +23,6 @@ pub struct ParNode {
}
/// A child of a paragraph node.
-#[derive(Debug)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub enum ParChild {
/// Spacing between other nodes.
@@ -93,6 +93,16 @@ impl From<ParNode> for LayoutNode {
}
}
+impl Debug for ParChild {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ match self {
+ ParChild::Spacing(v) => write!(f, "Spacing({:?})", v),
+ ParChild::Text(text, ..) => write!(f, "Text({:?})", text),
+ ParChild::Any(node, ..) => f.debug_tuple("Any").field(node).finish(),
+ }
+ }
+}
+
/// A paragraph representation in which children are already layouted and text
/// is separated into shapable runs.
struct ParLayouter<'a> {