[bitboard] Implement From<Option<Square>> for BitBoard
Return an empty BitBoard if the input is None.
This commit is contained in:
parent
d20119dfe3
commit
349d82304d
1 changed files with 6 additions and 0 deletions
|
@ -164,6 +164,12 @@ impl From<File> for BitBoard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Option<Square>> for BitBoard {
|
||||||
|
fn from(value: Option<Square>) -> Self {
|
||||||
|
value.map_or(BitBoard::EMPTY, Into::<BitBoard>::into)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<Rank> for BitBoard {
|
impl From<Rank> for BitBoard {
|
||||||
fn from(value: Rank) -> Self {
|
fn from(value: Rank) -> Self {
|
||||||
library::FILES[*value.as_index() as usize]
|
library::FILES[*value.as_index() as usize]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue