aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-12-03 12:56:39 -0800
committerAustin Hellyer <[email protected]>2016-12-03 13:14:16 -0800
commit1d693a735563f019ac04964d250b9936f4a31477 (patch)
tree41d329a3942f932fd65a70cfad90c14f6cd7e8b6 /src
parentAdd Member::colour (diff)
downloadserenity-1d693a735563f019ac04964d250b9936f4a31477.tar.xz
serenity-1d693a735563f019ac04964d250b9936f4a31477.zip
Derive Eq/Ord on Colour
Diffstat (limited to 'src')
-rw-r--r--src/utils/colour.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/utils/colour.rs b/src/utils/colour.rs
index ae4d212..c62630a 100644
--- a/src/utils/colour.rs
+++ b/src/utils/colour.rs
@@ -48,10 +48,23 @@ macro_rules! colour {
/// assert_eq!(colour.get_tuple(), (17, 128, 106));
/// ```
///
+/// Colours can also be directly compared for equivilance:
+///
+/// ```rust
+/// use serenity::utils::Colour;
+///
+/// let blitz_blue = Colour::blitz_blue();
+/// let fooyoo = Colour::fooyoo();
+/// let fooyoo2 = Colour::fooyoo();
+/// assert!(blitz_blue != fooyoo);
+/// assert_eq!(fooyoo, fooyoo2);
+/// assert!(blitz_blue > fooyoo);
+/// ```
+///
/// [`Role`]: ../model/struct.Role.html
/// [`dark_teal`]: #method.dark_teal
/// [`get_g`]: #method.get_g
-#[derive(Clone, Copy, Debug)]
+#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Colour {
/// The raw inner 32-bit unsigned integer value of this Colour. This is
/// worked with to generate values such as the red component value.