schachmatt 0.3.0

A chess library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Defines the two player colors of a chess game `Black` and `White`.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum PlayerColor {
    Black,
    White,
}

impl PlayerColor {
    /// Returns the player color not currently represented by self.
    /// - `returns` - The reversed player color
    #[must_use]
    pub fn reverse(&self) -> PlayerColor {
        match self {
            PlayerColor::Black => PlayerColor::White,
            PlayerColor::White => PlayerColor::Black,
        }
    }
}