use std::ops::Not;
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Color {
White,
Black,
}
impl Color {
#[inline]
pub const fn to_char(self) -> char {
match self {
Color::White => 'w',
Color::Black => 'b',
}
}
#[inline]
pub const fn index(&self) -> usize {
*self as usize
}
}
impl Not for Color {
type Output = Self;
#[inline]
fn not(self) -> Self::Output {
match self {
Color::White => Color::Black,
Color::Black => Color::White,
}
}
}