1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crate::helpers::simple_enum! {
    /// A side to move.
    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
    pub enum Color {
        /// The color white.
        White,
        /// The color black.
        Black
    }
}

crate::helpers::enum_char_conv! {
    Color, ColorParseError {
        White = 'w',
        Black = 'b'
    }
}

impl core::ops::Not for Color {
    type Output = Self;

    #[inline(always)]
    fn not(self) -> Self::Output {
        match self {
            Self::White => Self::Black,
            Self::Black => Self::White
        }
    }
}