From 66301022a14f46ac528f766ff4e87ecc2b346e27 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] Implement Eq for Alpha, Luma, and Rgb Implement Eq on colorspaces where T: Component + Eq --- palette/src/alpha/alpha.rs | 2 ++ palette/src/luma/luma.rs | 7 +++++++ palette/src/rgb/rgb.rs | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/palette/src/alpha/alpha.rs b/palette/src/alpha/alpha.rs index ce7a9bb4e..456d6b0fc 100644 --- a/palette/src/alpha/alpha.rs +++ b/palette/src/alpha/alpha.rs @@ -212,6 +212,8 @@ impl Default for Alpha { } } +impl Eq for Alpha {} + impl AbsDiffEq for Alpha where C: AbsDiffEq, diff --git a/palette/src/luma/luma.rs b/palette/src/luma/luma.rs index c78fe7bb5..a7089f3d0 100644 --- a/palette/src/luma/luma.rs +++ b/palette/src/luma/luma.rs @@ -675,6 +675,13 @@ where } } +impl Eq for Luma +where + T: Component + Eq, + S: LumaStandard + Eq, +{ +} + impl AbsDiffEq for Luma where T: Component + AbsDiffEq, diff --git a/palette/src/rgb/rgb.rs b/palette/src/rgb/rgb.rs index ead922041..cf9354170 100644 --- a/palette/src/rgb/rgb.rs +++ b/palette/src/rgb/rgb.rs @@ -873,6 +873,13 @@ impl Into<(T, T, T, A)> for Alpha Eq for Rgb +where + T: Component + Eq, + S: RgbStandard + Eq, +{ +} + impl AbsDiffEq for Rgb where T: Component + AbsDiffEq,