[board] Implement Display for Color
This commit is contained in:
parent
7424236f1d
commit
c2a115cee9
1 changed files with 13 additions and 0 deletions
|
@ -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 {
|
impl TryFrom<char> for Color {
|
||||||
type Error = TryFromError;
|
type Error = TryFromError;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue