diff options
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/nodes/document.rs | 5 | ||||
| -rw-r--r-- | src/layout/nodes/mod.rs | 31 |
2 files changed, 12 insertions, 24 deletions
diff --git a/src/layout/nodes/document.rs b/src/layout/nodes/document.rs index af7a31e6..5c7a2410 100644 --- a/src/layout/nodes/document.rs +++ b/src/layout/nodes/document.rs @@ -7,11 +7,6 @@ pub struct Document { } impl Document { - /// Create a new document. - pub fn new() -> Self { - Self { runs: vec![] } - } - /// Layout the document. pub async fn layout(&self, ctx: &mut LayoutContext) -> Vec<BoxLayout> { let mut layouts = vec![]; diff --git a/src/layout/nodes/mod.rs b/src/layout/nodes/mod.rs index 44c18284..a304e63c 100644 --- a/src/layout/nodes/mod.rs +++ b/src/layout/nodes/mod.rs @@ -75,7 +75,6 @@ impl Layout for LayoutNode { /// /// [`LayoutNode`]: enum.LayoutNode.html /// [Rust Issue]: https://github.com/rust-lang/rust/issues/31740 -#[derive(Clone)] pub struct Dynamic(pub Box<dyn DynNode>); impl Dynamic { @@ -85,12 +84,6 @@ impl Dynamic { } } -impl PartialEq for Dynamic { - fn eq(&self, other: &Self) -> bool { - &self.0 == &other.0 - } -} - impl Deref for Dynamic { type Target = dyn DynNode; @@ -105,6 +98,18 @@ impl Debug for Dynamic { } } +impl Clone for Dynamic { + fn clone(&self) -> Self { + Self(self.0.dyn_clone()) + } +} + +impl PartialEq for Dynamic { + fn eq(&self, other: &Self) -> bool { + self.0.dyn_eq(other.0.as_ref()) + } +} + impl From<Dynamic> for LayoutNode { fn from(dynamic: Dynamic) -> Self { Self::Dyn(dynamic) @@ -153,15 +158,3 @@ where Box::new(self.clone()) } } - -impl Clone for Box<dyn DynNode> { - fn clone(&self) -> Self { - self.dyn_clone() - } -} - -impl PartialEq for Box<dyn DynNode> { - fn eq(&self, other: &Self) -> bool { - self.dyn_eq(other.as_ref()) - } -} |
