[board] Implement Display for Color

This commit is contained in:
Eryn Wells 2024-01-22 08:18:49 -08:00
parent 7424236f1d
commit c2a115cee9

View file

@ -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<char> for Color {
type Error = TryFromError;