summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/background.rs2
-rw-r--r--src/layout/fixed.rs2
-rw-r--r--src/layout/frame.rs12
-rw-r--r--src/layout/grid.rs4
-rw-r--r--src/layout/image.rs2
-rw-r--r--src/layout/incremental.rs4
-rw-r--r--src/layout/mod.rs12
-rw-r--r--src/layout/pad.rs2
-rw-r--r--src/layout/par.rs4
-rw-r--r--src/layout/stack.rs4
10 files changed, 25 insertions, 23 deletions
diff --git a/src/layout/background.rs b/src/layout/background.rs
index 0e93c06f..867783bf 100644
--- a/src/layout/background.rs
+++ b/src/layout/background.rs
@@ -1,7 +1,7 @@
use super::*;
/// A node that places a rectangular filled background behind its child.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct BackgroundNode {
/// The kind of shape to use as a background.
diff --git a/src/layout/fixed.rs b/src/layout/fixed.rs
index c1d1ac5e..dfcd4038 100644
--- a/src/layout/fixed.rs
+++ b/src/layout/fixed.rs
@@ -1,7 +1,7 @@
use super::*;
/// A node that can fix its child's width and height.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct FixedNode {
/// The fixed width, if any.
diff --git a/src/layout/frame.rs b/src/layout/frame.rs
index 65a55857..862dc4be 100644
--- a/src/layout/frame.rs
+++ b/src/layout/frame.rs
@@ -9,7 +9,7 @@ use crate::geom::{Length, Path, Point, Size};
use crate::image::ImageId;
/// A finished layout with elements at fixed positions.
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Default, Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct Frame {
/// The size of the frame.
pub size: Size,
@@ -99,14 +99,14 @@ impl Frame {
/// A frame can contain multiple children: elements or other frames, complete
/// with their children.
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
enum Child {
Element(Element),
Frame(Rc<Frame>),
}
/// The building block frames are composed of.
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub enum Element {
/// Shaped text.
Text(Text),
@@ -118,7 +118,7 @@ pub enum Element {
}
/// A run of shaped text.
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct Text {
/// The font face the glyphs are contained in.
pub face_id: FaceId,
@@ -131,7 +131,7 @@ pub struct Text {
}
/// A glyph in a run of shaped text.
-#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct Glyph {
/// The glyph's index in the face.
pub id: u16,
@@ -155,7 +155,7 @@ impl Text {
}
/// A geometric shape.
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub enum Geometry {
/// A filled rectangle with its origin in the topleft corner.
Rect(Size),
diff --git a/src/layout/grid.rs b/src/layout/grid.rs
index b0bf225f..06b6596c 100644
--- a/src/layout/grid.rs
+++ b/src/layout/grid.rs
@@ -1,7 +1,7 @@
use super::*;
/// A node that arranges its children in a grid.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct GridNode {
/// The `main` and `cross` directions of this grid.
@@ -18,7 +18,7 @@ pub struct GridNode {
}
/// Defines how to size a grid cell along an axis.
-#[derive(Debug, Copy, Clone, PartialEq, Hash)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum TrackSizing {
/// Fit the cell to its contents.
Auto,
diff --git a/src/layout/image.rs b/src/layout/image.rs
index 20a521ff..9ea9db55 100644
--- a/src/layout/image.rs
+++ b/src/layout/image.rs
@@ -4,7 +4,7 @@ use crate::image::ImageId;
use ::image::GenericImageView;
/// An image node.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct ImageNode {
/// The id of the image file.
diff --git a/src/layout/incremental.rs b/src/layout/incremental.rs
index d41fe431..429dc514 100644
--- a/src/layout/incremental.rs
+++ b/src/layout/incremental.rs
@@ -168,7 +168,7 @@ impl FramesEntry {
}
/// Describe regions that match them.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Constraints {
/// The minimum available length in the region.
pub min: Spec<Option<Length>>,
@@ -253,7 +253,7 @@ impl Constraints {
/// Carries an item that only applies to certain regions and the constraints
/// that describe these regions.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Constrained<T> {
pub item: T,
pub constraints: Constraints,
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<PageRun>,
@@ -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<T>(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<T> 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,
diff --git a/src/layout/pad.rs b/src/layout/pad.rs
index 75ed366c..3770c754 100644
--- a/src/layout/pad.rs
+++ b/src/layout/pad.rs
@@ -1,7 +1,7 @@
use super::*;
/// A node that adds padding to its child.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct PadNode {
/// The amount of padding.
diff --git a/src/layout/par.rs b/src/layout/par.rs
index 34016737..5d21e05e 100644
--- a/src/layout/par.rs
+++ b/src/layout/par.rs
@@ -11,7 +11,7 @@ use crate::util::{RangeExt, SliceExt};
type Range = std::ops::Range<usize>;
/// A node that arranges its children into a paragraph.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct ParNode {
/// The inline direction of this paragraph.
@@ -23,7 +23,7 @@ pub struct ParNode {
}
/// A child of a paragraph node.
-#[derive(Clone, PartialEq)]
+#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub enum ParChild {
/// Spacing between other nodes.
diff --git a/src/layout/stack.rs b/src/layout/stack.rs
index d8e30b2a..516a2284 100644
--- a/src/layout/stack.rs
+++ b/src/layout/stack.rs
@@ -3,7 +3,7 @@ use decorum::N64;
use super::*;
/// A node that stacks its children.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub struct StackNode {
/// The `main` and `cross` directions of this stack.
@@ -20,7 +20,7 @@ pub struct StackNode {
}
/// A child of a stack node.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "layout-cache", derive(Hash))]
pub enum StackChild {
/// Spacing between other nodes.