[board] Implement Board::unwrap_color
Unwrap an Option<Color> using the board's active color in the default case.
This commit is contained in:
parent
574ab803dd
commit
994f17091b
1 changed files with 7 additions and 0 deletions
|
@ -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::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue