[board] Implement Board::unwrap_color

Unwrap an Option<Color> using the board's active color in the default case.
This commit is contained in:
Eryn Wells 2025-05-23 18:37:13 -07:00
parent 574ab803dd
commit 994f17091b

View file

@ -117,6 +117,13 @@ impl Board {
}
}
impl Board {
#[must_use]
pub fn unwrap_color(&self, color: Option<Color>) -> Color {
color.unwrap_or(self.active_color)
}
}
#[cfg(test)]
mod tests {
use super::*;