w_chess/
piece.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum Piece {
3    PAWN = 0,
4    BISHOP = 1,
5    KNIGHT = 2,
6    ROOK = 3,
7    QUEEN = 4,
8    KING = 5,
9    UNKNOWN = 6,
10}
11
12impl std::fmt::Display for Piece {
13    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14        let symbol = match self {
15            Piece::PAWN => "Pawn",
16            Piece::BISHOP => "Bishop",
17            Piece::KNIGHT => "Knight",
18            Piece::ROOK => "Rook",
19            Piece::QUEEN => "Queen",
20            Piece::KING => "King",
21            Piece::UNKNOWN => "?",
22        };
23        write!(f, "{}", symbol)
24    }
25}