From bfbf032fff012bb04d5f8d0fc91c720d7e0f5ca8 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Wed, 1 Dec 2021 17:17:12 +0000 Subject: [PATCH] Implement Debug manually for ColorSpace --- src/colorspace.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/colorspace.rs b/src/colorspace.rs index 6b8b600..14706c2 100644 --- a/src/colorspace.rs +++ b/src/colorspace.rs @@ -1,4 +1,6 @@ -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +use std::fmt::{self, Debug}; + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct ColorSpace { pub r_linear: bool, pub g_linear: bool, @@ -56,3 +58,13 @@ impl From for u8 { value.to_u8() } } + +impl Debug for ColorSpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "ColorSpace({}{}{}{})", + self.r_linear as u8, self.g_linear as u8, self.b_linear as u8, self.a_linear as u8 + ) + } +}