1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use super::Piece;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Square {
piece: Option<Piece>,
}
pub const EMPTY_SQUARE: Square = Square { piece: None };
impl From<Piece> for Square {
fn from(piece: Piece) -> Self {
Self { piece: Some(piece) }
}
}
impl Square {
#[inline]
pub fn is_empty(&self) -> bool {
self.piece == None
}
#[inline]
pub fn get_piece(&self) -> Option<Piece> {
self.piece
}
}