From e50b49b3e7103b0f23eb101437458e2986d9dfc6 Mon Sep 17 00:00:00 2001 From: okaneco <47607823+okaneco@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:13:09 -0400 Subject: [PATCH 1/3] Implement Eq for all colorspaces plus Alpha, PreAlpha, and Hue types Implement Eq for: - Alpha - PreAlpha - Luma - Rgb - Hsl - Hsv - LabHue/RgbHue - Hwb - Lab - Lch - Xyz - Yxy --- palette/src/alpha/alpha.rs | 2 +- palette/src/blend/pre_alpha.rs | 2 +- palette/src/hsl.rs | 2 +- palette/src/hsv.rs | 2 +- palette/src/hues.rs | 2 ++ palette/src/hwb.rs | 2 +- palette/src/lab.rs | 2 +- palette/src/lch.rs | 2 +- palette/src/luma/luma.rs | 2 +- palette/src/rgb/rgb.rs | 2 +- palette/src/xyz.rs | 2 +- palette/src/yxy.rs | 2 +- 12 files changed, 13 insertions(+), 11 deletions(-) diff --git a/palette/src/alpha/alpha.rs b/palette/src/alpha/alpha.rs index 0db96f389..6641985b5 100644 --- a/palette/src/alpha/alpha.rs +++ b/palette/src/alpha/alpha.rs @@ -19,7 +19,7 @@ use crate::{ }; /// An alpha component wrapper for colors. -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[repr(C)] pub struct Alpha { diff --git a/palette/src/blend/pre_alpha.rs b/palette/src/blend/pre_alpha.rs index 9460d20f8..3ef64269a 100644 --- a/palette/src/blend/pre_alpha.rs +++ b/palette/src/blend/pre_alpha.rs @@ -27,7 +27,7 @@ use crate::{clamp, Alpha, Blend, ComponentWise, Mix, Pixel}; /// /// Note that converting to and from premultiplied alpha will cause the alpha /// component to be clamped to [0.0, 1.0]. -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[repr(C)] pub struct PreAlpha { diff --git a/palette/src/hsl.rs b/palette/src/hsl.rs index 6de171116..b79139df6 100644 --- a/palette/src/hsl.rs +++ b/palette/src/hsl.rs @@ -35,7 +35,7 @@ pub type Hsla = Alpha, T>; /// /// See [HSV](crate::Hsv) for a very similar color space, with brightness /// instead of lightness. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/hsv.rs b/palette/src/hsv.rs index d5222bbba..2a787236e 100644 --- a/palette/src/hsv.rs +++ b/palette/src/hsv.rs @@ -32,7 +32,7 @@ pub type Hsva = Alpha, T>; /// _lightness_. The difference is that, for example, red (100% R, 0% G, 0% B) /// and white (100% R, 100% G, 100% B) has the same brightness (or value), but /// not the same lightness. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/hues.rs b/palette/src/hues.rs index c116e5767..f3d27c148 100644 --- a/palette/src/hues.rs +++ b/palette/src/hues.rs @@ -119,6 +119,8 @@ macro_rules! make_hues { } } + impl Eq for $name {} + impl Add<$name> for $name { type Output = $name; diff --git a/palette/src/hwb.rs b/palette/src/hwb.rs index fd5d0750a..36b968d0c 100644 --- a/palette/src/hwb.rs +++ b/palette/src/hwb.rs @@ -33,7 +33,7 @@ pub type Hwba = Alpha, T>; /// /// It is very intuitive for humans to use and many color-pickers are based on /// the HWB color system -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/lab.rs b/palette/src/lab.rs index d3d6665be..751d53464 100644 --- a/palette/src/lab.rs +++ b/palette/src/lab.rs @@ -33,7 +33,7 @@ pub type Laba = Alpha, T>; /// /// The parameters of L\*a\*b\* are quite different, compared to many other /// color spaces, so manipulating them manually may be unintuitive. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/lch.rs b/palette/src/lch.rs index cdd9ebade..bc875b18e 100644 --- a/palette/src/lch.rs +++ b/palette/src/lch.rs @@ -28,7 +28,7 @@ pub type Lcha = Alpha, T>; /// it's a cylindrical color space, like [HSL](crate::Hsl) and /// [HSV](crate::Hsv). This gives it the same ability to directly change /// the hue and colorfulness of a color, while preserving other visual aspects. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/luma/luma.rs b/palette/src/luma/luma.rs index 3ca45b2da..1aa14e77d 100644 --- a/palette/src/luma/luma.rs +++ b/palette/src/luma/luma.rs @@ -33,7 +33,7 @@ pub type Lumaa = Alpha, T>; /// perceived to be. It's basically the `Y` component of [CIE /// XYZ](crate::Xyz). The lack of any form of hue representation limits /// the set of operations that can be performed on it. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/rgb/rgb.rs b/palette/src/rgb/rgb.rs index 7d4eb6b88..ec80e5140 100644 --- a/palette/src/rgb/rgb.rs +++ b/palette/src/rgb/rgb.rs @@ -43,7 +43,7 @@ pub type Rgba = Alpha, T>; /// linear, meaning that gamma correction is required when converting to and /// from a displayable RGB, such as sRGB. See the [`pixel`](crate::encoding::pixel) /// module for encoding formats. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/xyz.rs b/palette/src/xyz.rs index 17d379eb3..9c537bb71 100644 --- a/palette/src/xyz.rs +++ b/palette/src/xyz.rs @@ -32,7 +32,7 @@ pub type Xyza = Alpha, T>; /// /// Conversions and operations on this color space depend on the defined white /// point -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, diff --git a/palette/src/yxy.rs b/palette/src/yxy.rs index 96f5af5b2..48b088d3c 100644 --- a/palette/src/yxy.rs +++ b/palette/src/yxy.rs @@ -28,7 +28,7 @@ pub type Yxya = Alpha, T>; /// for the color spaces are a plot of this color space's x and y coordinates. /// /// Conversions and operations on this color space depend on the white point. -#[derive(Debug, PartialEq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, From dd51854e9f25ee63dd36db07aad68bee2442e822 Mon Sep 17 00:00:00 2001 From: okaneco <47607823+okaneco@users.noreply.github.com> Date: Sun, 4 Apr 2021 08:40:26 -0400 Subject: [PATCH 2/3] Add handwritten PartialEq and Eq impls Add Component bound to T for AbsDiffEq, RelativeEq, and UlpsEq in Alpha --- palette/src/alpha/alpha.rs | 25 +++++++++++++++++++++---- palette/src/blend/pre_alpha.rs | 19 ++++++++++++++++++- palette/src/hsl.rs | 19 ++++++++++++++++++- palette/src/hsv.rs | 19 ++++++++++++++++++- palette/src/hwb.rs | 21 ++++++++++++++++++++- palette/src/lab.rs | 19 ++++++++++++++++++- palette/src/lch.rs | 19 ++++++++++++++++++- palette/src/luma/luma.rs | 19 ++++++++++++++++++- palette/src/rgb/rgb.rs | 19 ++++++++++++++++++- palette/src/xyz.rs | 19 ++++++++++++++++++- palette/src/yxy.rs | 19 ++++++++++++++++++- 11 files changed, 203 insertions(+), 14 deletions(-) diff --git a/palette/src/alpha/alpha.rs b/palette/src/alpha/alpha.rs index 6641985b5..8f669ec20 100644 --- a/palette/src/alpha/alpha.rs +++ b/palette/src/alpha/alpha.rs @@ -19,7 +19,7 @@ use crate::{ }; /// An alpha component wrapper for colors. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[repr(C)] pub struct Alpha { @@ -44,6 +44,23 @@ impl Alpha { } } +impl PartialEq for Alpha +where + T: Component + PartialEq, + C: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.color == other.color && self.alpha == other.alpha + } +} + +impl Eq for Alpha +where + T: Component + Eq, + C: Eq, +{ +} + impl, C2, T: Component> FromColorUnclamped for Alpha where C1::Color: IntoColorUnclamped, @@ -215,7 +232,7 @@ impl Default for Alpha { impl AbsDiffEq for Alpha where C: AbsDiffEq, - T: AbsDiffEq, + T: AbsDiffEq + Component, T::Epsilon: Clone, { type Epsilon = T::Epsilon; @@ -233,7 +250,7 @@ where impl RelativeEq for Alpha where C: RelativeEq, - T: RelativeEq, + T: RelativeEq + Component, T::Epsilon: Clone, { fn default_max_relative() -> Self::Epsilon { @@ -255,7 +272,7 @@ where impl UlpsEq for Alpha where C: UlpsEq, - T: UlpsEq, + T: UlpsEq + Component, T::Epsilon: Clone, { fn default_max_ulps() -> u32 { diff --git a/palette/src/blend/pre_alpha.rs b/palette/src/blend/pre_alpha.rs index 3ef64269a..ac08a8520 100644 --- a/palette/src/blend/pre_alpha.rs +++ b/palette/src/blend/pre_alpha.rs @@ -27,7 +27,7 @@ use crate::{clamp, Alpha, Blend, ComponentWise, Mix, Pixel}; /// /// Note that converting to and from premultiplied alpha will cause the alpha /// component to be clamped to [0.0, 1.0]. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[repr(C)] pub struct PreAlpha { @@ -40,6 +40,23 @@ pub struct PreAlpha { pub alpha: T, } +impl PartialEq for PreAlpha +where + T: Float + PartialEq, + C: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.color == other.color && self.alpha == other.alpha + } +} + +impl Eq for PreAlpha +where + T: Float + Eq, + C: Eq, +{ +} + impl From> for PreAlpha where C: ComponentWise, diff --git a/palette/src/hsl.rs b/palette/src/hsl.rs index b79139df6..4f7d83d28 100644 --- a/palette/src/hsl.rs +++ b/palette/src/hsl.rs @@ -35,7 +35,7 @@ pub type Hsla = Alpha, T>; /// /// See [HSV](crate::Hsv) for a very similar color space, with brightness /// instead of lightness. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -158,6 +158,23 @@ where } } +impl PartialEq for Hsl +where + T: FloatComponent + PartialEq, + S: RgbStandard, +{ + fn eq(&self, other: &Self) -> bool { + self.hue == other.hue && self.saturation == other.saturation && self.lightness == other.lightness + } +} + +impl Eq for Hsl +where + T: FloatComponent + Eq, + S: RgbStandard, +{ +} + ///[`Hsla`](crate::Hsla) implementations. impl Alpha, A> where diff --git a/palette/src/hsv.rs b/palette/src/hsv.rs index 2a787236e..70bca9f8b 100644 --- a/palette/src/hsv.rs +++ b/palette/src/hsv.rs @@ -32,7 +32,7 @@ pub type Hsva = Alpha, T>; /// _lightness_. The difference is that, for example, red (100% R, 0% G, 0% B) /// and white (100% R, 100% G, 100% B) has the same brightness (or value), but /// not the same lightness. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -155,6 +155,23 @@ where } } +impl PartialEq for Hsv +where + T: FloatComponent + PartialEq, + S: RgbStandard, +{ + fn eq(&self, other: &Self) -> bool { + self.hue == other.hue && self.saturation == other.saturation && self.value == other.value + } +} + +impl Eq for Hsv +where + T: FloatComponent + Eq, + S: RgbStandard, +{ +} + ///[`Hsva`](crate::Hsva) implementations. impl Alpha, A> where diff --git a/palette/src/hwb.rs b/palette/src/hwb.rs index 36b968d0c..e4231bc0b 100644 --- a/palette/src/hwb.rs +++ b/palette/src/hwb.rs @@ -33,7 +33,7 @@ pub type Hwba = Alpha, T>; /// /// It is very intuitive for humans to use and many color-pickers are based on /// the HWB color system -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -161,6 +161,25 @@ where } } +impl PartialEq for Hwb +where + T: FloatComponent + PartialEq, + S: RgbStandard, +{ + fn eq(&self, other: &Self) -> bool { + self.hue == other.hue + && self.whiteness == other.whiteness + && self.blackness == other.blackness + } +} + +impl Eq for Hwb +where + T: FloatComponent + Eq, + S: RgbStandard, +{ +} + ///[`Hwba`](crate::Hwba) implementations. impl Alpha, A> where diff --git a/palette/src/lab.rs b/palette/src/lab.rs index 751d53464..ba4a15f58 100644 --- a/palette/src/lab.rs +++ b/palette/src/lab.rs @@ -33,7 +33,7 @@ pub type Laba = Alpha, T>; /// /// The parameters of L\*a\*b\* are quite different, compared to many other /// color spaces, so manipulating them manually may be unintuitive. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -152,6 +152,23 @@ where } } +impl PartialEq for Lab +where + T: FloatComponent + PartialEq, + Wp: WhitePoint, +{ + fn eq(&self, other: &Self) -> bool { + self.l == other.l && self.a == other.a && self.b == other.b + } +} + +impl Eq for Lab +where + T: FloatComponent + Eq, + Wp: WhitePoint, +{ +} + ///[`Laba`](crate::Laba) implementations. impl Alpha, A> where diff --git a/palette/src/lch.rs b/palette/src/lch.rs index bc875b18e..61cdf158f 100644 --- a/palette/src/lch.rs +++ b/palette/src/lch.rs @@ -28,7 +28,7 @@ pub type Lcha = Alpha, T>; /// it's a cylindrical color space, like [HSL](crate::Hsl) and /// [HSV](crate::Hsv). This gives it the same ability to directly change /// the hue and colorfulness of a color, while preserving other visual aspects. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -151,6 +151,23 @@ where } } +impl PartialEq for Lch +where + T: FloatComponent + PartialEq, + Wp: WhitePoint, +{ + fn eq(&self, other: &Self) -> bool { + self.l == other.l && self.chroma == other.chroma && self.hue == other.hue + } +} + +impl Eq for Lch +where + T: FloatComponent + Eq, + Wp: WhitePoint, +{ +} + ///[`Lcha`](crate::Lcha) implementations. impl Alpha, A> where diff --git a/palette/src/luma/luma.rs b/palette/src/luma/luma.rs index 1aa14e77d..e43f506e8 100644 --- a/palette/src/luma/luma.rs +++ b/palette/src/luma/luma.rs @@ -33,7 +33,7 @@ pub type Lumaa = Alpha, T>; /// perceived to be. It's basically the `Y` component of [CIE /// XYZ](crate::Xyz). The lack of any form of hue representation limits /// the set of operations that can be performed on it. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -166,6 +166,23 @@ where } } +impl PartialEq for Luma +where + T: Component + PartialEq, + S: LumaStandard, +{ + fn eq(&self, other: &Self) -> bool { + self.luma == other.luma + } +} + +impl Eq for Luma +where + T: Component + Eq, + S: LumaStandard, +{ +} + ///[`Lumaa`](crate::luma::Lumaa) implementations. impl Alpha, A> where diff --git a/palette/src/rgb/rgb.rs b/palette/src/rgb/rgb.rs index ec80e5140..d08e8ed98 100644 --- a/palette/src/rgb/rgb.rs +++ b/palette/src/rgb/rgb.rs @@ -43,7 +43,7 @@ pub type Rgba = Alpha, T>; /// linear, meaning that gamma correction is required when converting to and /// from a displayable RGB, such as sRGB. See the [`pixel`](crate::encoding::pixel) /// module for encoding formats. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -154,6 +154,23 @@ impl Rgb { } } +impl PartialEq for Rgb +where + T: Component + PartialEq, + S: RgbStandard, +{ + fn eq(&self, other: &Self) -> bool { + self.red == other.red && self.green == other.green && self.blue == other.blue + } +} + +impl Eq for Rgb +where + T: Component + Eq, + S: RgbStandard, +{ +} + /// Convenience functions to convert between a packed `u32` and `Rgb`. /// /// ``` diff --git a/palette/src/xyz.rs b/palette/src/xyz.rs index 9c537bb71..ec6991ed3 100644 --- a/palette/src/xyz.rs +++ b/palette/src/xyz.rs @@ -32,7 +32,7 @@ pub type Xyza = Alpha, T>; /// /// Conversions and operations on this color space depend on the defined white /// point -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -157,6 +157,23 @@ where } } +impl PartialEq for Xyz +where + T: FloatComponent + PartialEq, + Wp: WhitePoint, +{ + fn eq(&self, other: &Self) -> bool { + self.x == other.x && self.y == other.y && self.z == other.z + } +} + +impl Eq for Xyz +where + T: FloatComponent + Eq, + Wp: WhitePoint, +{ +} + ///[`Xyza`](crate::Xyza) implementations. impl Alpha, A> where diff --git a/palette/src/yxy.rs b/palette/src/yxy.rs index 48b088d3c..5388dcb5e 100644 --- a/palette/src/yxy.rs +++ b/palette/src/yxy.rs @@ -28,7 +28,7 @@ pub type Yxya = Alpha, T>; /// for the color spaces are a plot of this color space's x and y coordinates. /// /// Conversions and operations on this color space depend on the white point. -#[derive(Debug, PartialEq, Eq, Pixel, FromColorUnclamped, WithAlpha)] +#[derive(Debug, Pixel, FromColorUnclamped, WithAlpha)] #[cfg_attr(feature = "serializing", derive(Serialize, Deserialize))] #[palette( palette_internal, @@ -150,6 +150,23 @@ where } } +impl PartialEq for Yxy +where + T: FloatComponent + PartialEq, + Wp: WhitePoint, +{ + fn eq(&self, other: &Self) -> bool { + self.luma == other.luma && self.x == other.x && self.y == other.y + } +} + +impl Eq for Yxy +where + T: FloatComponent + Eq, + Wp: WhitePoint, +{ +} + ///[`Yxya`](crate::Yxya) implementations. impl Alpha, A> where From a1ee6a19f95f094e7cd8c6cd95a25e6bcdf5ffd7 Mon Sep 17 00:00:00 2001 From: okaneco <47607823+okaneco@users.noreply.github.com> Date: Sun, 4 Apr 2021 09:18:50 -0400 Subject: [PATCH 3/3] Remove unnecessary Component bound on Alpha --- palette/src/alpha/alpha.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/palette/src/alpha/alpha.rs b/palette/src/alpha/alpha.rs index 8f669ec20..83f757e5c 100644 --- a/palette/src/alpha/alpha.rs +++ b/palette/src/alpha/alpha.rs @@ -46,7 +46,7 @@ impl Alpha { impl PartialEq for Alpha where - T: Component + PartialEq, + T: PartialEq, C: PartialEq, { fn eq(&self, other: &Self) -> bool { @@ -56,7 +56,7 @@ where impl Eq for Alpha where - T: Component + Eq, + T: Eq, C: Eq, { } @@ -232,7 +232,7 @@ impl Default for Alpha { impl AbsDiffEq for Alpha where C: AbsDiffEq, - T: AbsDiffEq + Component, + T: AbsDiffEq, T::Epsilon: Clone, { type Epsilon = T::Epsilon; @@ -250,7 +250,7 @@ where impl RelativeEq for Alpha where C: RelativeEq, - T: RelativeEq + Component, + T: RelativeEq, T::Epsilon: Clone, { fn default_max_relative() -> Self::Epsilon { @@ -272,7 +272,7 @@ where impl UlpsEq for Alpha where C: UlpsEq, - T: UlpsEq + Component, + T: UlpsEq, T::Epsilon: Clone, { fn default_max_ulps() -> u32 {