From c2a115cee94d098e1749d6e4a25fe4b5c522623f Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 22 Jan 2024 08:18:49 -0800 Subject: [PATCH] [board] Implement Display for Color --- board/src/piece.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/board/src/piece.rs b/board/src/piece.rs index 7dc2e8f..f65a7b8 100644 --- a/board/src/piece.rs +++ b/board/src/piece.rs @@ -38,6 +38,19 @@ impl Default for Color { } } +impl fmt::Display for Color { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "{}", + match self { + Color::White => "White", + Color::Black => "Black", + }, + ) + } +} + impl TryFrom for Color { type Error = TryFromError;