Skip to content

Commit

Permalink
Implement Eq for Alpha, Luma, and Rgb
Browse files Browse the repository at this point in the history
Implement Eq on colorspaces where T: Component + Eq
  • Loading branch information
okaneco committed Apr 4, 2021
1 parent 00f8e6a commit 6630102
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions palette/src/alpha/alpha.rs
Expand Up @@ -212,6 +212,8 @@ impl<C: Default, T: Component> Default for Alpha<C, T> {
}
}

impl<C: Eq, T: Eq> Eq for Alpha<C, T> {}

impl<C, T> AbsDiffEq for Alpha<C, T>
where
C: AbsDiffEq<Epsilon = T::Epsilon>,
Expand Down
7 changes: 7 additions & 0 deletions palette/src/luma/luma.rs
Expand Up @@ -675,6 +675,13 @@ where
}
}

impl<S, T> Eq for Luma<S, T>
where
T: Component + Eq,
S: LumaStandard + Eq,
{
}

impl<S, T> AbsDiffEq for Luma<S, T>
where
T: Component + AbsDiffEq,
Expand Down
7 changes: 7 additions & 0 deletions palette/src/rgb/rgb.rs
Expand Up @@ -873,6 +873,13 @@ impl<S: RgbStandard, T: Component, A: Component> Into<(T, T, T, A)> for Alpha<Rg
}
}

impl<S, T> Eq for Rgb<S, T>
where
T: Component + Eq,
S: RgbStandard + Eq,
{
}

impl<S, T> AbsDiffEq for Rgb<S, T>
where
T: Component + AbsDiffEq,
Expand Down

0 comments on commit 6630102

Please sign in to comment.