[board] Create const arrays for Shape that return &'static to its enum cases
This commit is contained in:
parent
878d771d86
commit
750b16970f
3 changed files with 17 additions and 8 deletions
|
@ -11,7 +11,7 @@ pub struct Pieces<'a> {
|
|||
|
||||
current_shape: Option<Shape>,
|
||||
|
||||
shape_iterator: Box<dyn Iterator<Item = Shape>>,
|
||||
shape_iterator: Box<dyn Iterator<Item = &'static Shape>>,
|
||||
square_iterator: Option<Box<dyn Iterator<Item = Square>>>,
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ impl<'a> Iterator for Pieces<'a> {
|
|||
let mut next_nonempty_bitboard: Option<&BitBoard> = None;
|
||||
|
||||
while let Some(shape) = self.shape_iterator.next() {
|
||||
let piece = Piece::new(self.color, shape);
|
||||
let piece = Piece::new(self.color, *shape);
|
||||
|
||||
let bitboard = self.position.bitboard_for_piece(piece);
|
||||
if bitboard.is_empty() {
|
||||
|
@ -49,7 +49,7 @@ impl<'a> Iterator for Pieces<'a> {
|
|||
}
|
||||
|
||||
next_nonempty_bitboard = Some(bitboard);
|
||||
current_shape = Some(shape);
|
||||
current_shape = Some(*shape);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue