From 02b586cc36fad58a622ecb439e1cf3a76a347207 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 8 Jul 2021 23:16:02 +0200 Subject: Add lots of Eq impls --- src/layout/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index e8bdab62..bf6c8092 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -51,7 +51,7 @@ pub fn layout( } /// A tree of layout nodes. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct LayoutTree { /// Runs of pages with the same properties. pub runs: Vec, @@ -65,7 +65,7 @@ impl LayoutTree { } /// A run of pages that all have the same properties. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct PageRun { /// The size of each page. pub size: Size, @@ -98,7 +98,7 @@ impl AnyNode { #[cfg(feature = "layout-cache")] pub fn new(node: T) -> Self where - T: Layout + Debug + Clone + PartialEq + Hash + 'static, + T: Layout + Debug + Clone + Eq + PartialEq + Hash + 'static, { let hash = { let mut state = FxHasher64::default(); @@ -153,6 +153,8 @@ impl Clone for AnyNode { } } +impl Eq for AnyNode {} + impl PartialEq for AnyNode { fn eq(&self, other: &Self) -> bool { self.node.dyn_eq(other.node.as_ref()) @@ -180,7 +182,7 @@ trait Bounds: Layout + Debug + 'static { impl Bounds for T where - T: Layout + Debug + PartialEq + Clone + 'static, + T: Layout + Debug + Eq + PartialEq + Clone + 'static, { fn as_any(&self) -> &dyn Any { self @@ -221,7 +223,7 @@ pub struct LayoutContext<'a> { } /// A sequence of regions to layout into. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Regions { /// The remaining size of the current region. pub current: Size, -- cgit v1.2.3