pub enum Square {
Show 64 variants
H1,
G1,
F1,
E1,
D1,
C1,
B1,
A1,
H2,
G2,
F2,
E2,
D2,
C2,
B2,
A2,
H3,
G3,
F3,
E3,
D3,
C3,
B3,
A3,
H4,
G4,
F4,
E4,
D4,
C4,
B4,
A4,
H5,
G5,
F5,
E5,
D5,
C5,
B5,
A5,
H6,
G6,
F6,
E6,
D6,
C6,
B6,
A6,
H7,
G7,
F7,
E7,
D7,
C7,
B7,
A7,
H8,
G8,
F8,
E8,
D8,
C8,
B8,
A8,
}
Expand description
Type representing a square on a chessboard.
Variants§
H1
G1
F1
E1
D1
C1
B1
A1
H2
G2
F2
E2
D2
C2
B2
A2
H3
G3
F3
E3
D3
C3
B3
A3
H4
G4
F4
E4
D4
C4
B4
A4
H5
G5
F5
E5
D5
C5
B5
A5
H6
G6
F6
E6
D6
C6
B6
A6
H7
G7
F7
E7
D7
C7
B7
A7
H8
G8
F8
E8
D8
C8
B8
A8
Implementations§
Source§impl Square
impl Square
Sourcepub fn iter() -> impl Iterator<Item = Square>
pub fn iter() -> impl Iterator<Item = Square>
Return an iterator traversing all squares in order.
Sourcepub fn from_index(i: usize) -> Square
pub fn from_index(i: usize) -> Square
Retrieve a square by it’s corresponding index.
Sourcepub const fn rank_index(self) -> usize
pub const fn rank_index(self) -> usize
Return the index of the rank on which this square resides.
Sourcepub const fn file_index(self) -> usize
pub const fn file_index(self) -> usize
Return the index of the file on which this square resides.
Sourcepub fn rank(self) -> BitBoard
pub fn rank(self) -> BitBoard
Return a bitboard representing the rank on which this square resides.
Sourcepub fn file(self) -> BitBoard
pub fn file(self) -> BitBoard
Return a bitboard representing the file on which this square resides.
Sourcepub fn next(self, dir: Dir) -> Option<Square>
pub fn next(self, dir: Dir) -> Option<Square>
Finds the next square on a chessboard from this square in a given direction if it exists.
Sourcepub fn search(self, dir: Dir) -> BitBoard
pub fn search(self, dir: Dir) -> BitBoard
Find all squares in a given direction from this square and returns them as a set.
Sourcepub fn search_vec(self, dir: Dir) -> Vec<Square>
pub fn search_vec(self, dir: Dir) -> Vec<Square>
Find all squares in a given direction from this square and returns them as a vector where the squares are ordered in increasing distance from this square.
Sourcepub fn search_all(self, dirs: &Vec<Dir>) -> BitBoard
pub fn search_all(self, dirs: &Vec<Dir>) -> BitBoard
Find all squares in all directions in a given vector and returns them as a set.
Sourcepub fn search_one(self, dirs: &Vec<Dir>) -> BitBoard
pub fn search_one(self, dirs: &Vec<Dir>) -> BitBoard
Find the squares adjacent to this square in all of the given directions and returns them as a set.
Trait Implementations§
Source§impl BitOrAssign<Square> for BitBoard
impl BitOrAssign<Square> for BitBoard
Source§fn bitor_assign(&mut self, rhs: Square)
fn bitor_assign(&mut self, rhs: Square)
|=
operation. Read moreSource§impl BitXorAssign<Square> for BitBoard
impl BitXorAssign<Square> for BitBoard
Source§fn bitxor_assign(&mut self, rhs: Square)
fn bitxor_assign(&mut self, rhs: Square)
^=
operation. Read moreSource§impl FromIterator<Square> for BitBoard
A set of squares can be built from an iterator traversing squares.
impl FromIterator<Square> for BitBoard
A set of squares can be built from an iterator traversing squares.
Source§impl Ord for Square
impl Ord for Square
Source§impl PartialOrd for Square
impl PartialOrd for Square
impl Copy for Square
impl Eq for Square
impl StructuralPartialEq for Square
Auto Trait Implementations§
impl Freeze for Square
impl RefUnwindSafe for Square
impl Send for Square
impl Sync for Square
impl Unpin for Square
impl UnwindSafe for Square
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more