#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Piece { Black, White, } impl Piece { pub const fn flip(&self) -> Self { match self { Piece::Black => Piece::White, Piece::White => Piece::Black, } } pub const fn symbol(&self) -> &'static str { match self { Piece::White => "■", Piece::Black => "□", } } pub const fn text(&self) -> &'static str { match self { Piece::Black => "Black", Piece::White => "White", } } } impl std::ops::Not for Piece { type Output = Piece; fn not(self) -> Self::Output { self.flip() } }