Enum friendly_chess::chess::SquareCoordinate
source · #[repr(u8)]pub enum SquareCoordinate {
Show 65 variants
A8,
B8,
C8,
D8,
E8,
F8,
G8,
H8,
A7,
B7,
C7,
D7,
E7,
F7,
G7,
H7,
A6,
B6,
C6,
D6,
E6,
F6,
G6,
H6,
A5,
B5,
C5,
D5,
E5,
F5,
G5,
H5,
A4,
B4,
C4,
D4,
E4,
F4,
G4,
H4,
A3,
B3,
C3,
D3,
E3,
F3,
G3,
H3,
A2,
B2,
C2,
D2,
E2,
F2,
G2,
H2,
A1,
B1,
C1,
D1,
E1,
F1,
G1,
H1,
__BAD_COORD,
}Variants§
A8
B8
C8
D8
E8
F8
G8
H8
A7
B7
C7
D7
E7
F7
G7
H7
A6
B6
C6
D6
E6
F6
G6
H6
A5
B5
C5
D5
E5
F5
G5
H5
A4
B4
C4
D4
E4
F4
G4
H4
A3
B3
C3
D3
E3
F3
G3
H3
A2
B2
C2
D2
E2
F2
G2
H2
A1
B1
C1
D1
E1
F1
G1
H1
__BAD_COORD
Implementations§
source§impl SquareCoordinate
impl SquareCoordinate
sourcepub fn to_index(&self) -> usize
pub fn to_index(&self) -> usize
Convert a Square enum to its associated value (A8 = 0, B8 = 1, etc.)
pub fn is_light_sq(&self) -> bool
pub fn is_dark_sq(&self) -> bool
pub fn rank(&self) -> u8
pub fn file(&self) -> u8
pub fn above(&self) -> Result<Self, ChessError>
pub fn below(&self) -> Result<Self, ChessError>
pub fn left(&self) -> Result<Self, ChessError>
pub fn right(&self) -> Result<Self, ChessError>
pub fn upper_left(&self) -> Result<Self, ChessError>
pub fn upper_right(&self) -> Result<Self, ChessError>
pub fn lower_left(&self) -> Result<Self, ChessError>
pub fn lower_right(&self) -> Result<Self, ChessError>
pub fn subtract(&self, rhs: usize) -> Result<Self, ChessError>
Trait Implementations§
source§impl Clone for SquareCoordinate
impl Clone for SquareCoordinate
source§fn clone(&self) -> SquareCoordinate
fn clone(&self) -> SquareCoordinate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for SquareCoordinate
impl Debug for SquareCoordinate
source§impl PartialEq<SquareCoordinate> for SquareCoordinate
impl PartialEq<SquareCoordinate> for SquareCoordinate
source§fn eq(&self, other: &SquareCoordinate) -> bool
fn eq(&self, other: &SquareCoordinate) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for SquareCoordinate
impl Eq for SquareCoordinate
impl StructuralEq for SquareCoordinate
impl StructuralPartialEq for SquareCoordinate
Auto Trait Implementations§
impl RefUnwindSafe for SquareCoordinate
impl Send for SquareCoordinate
impl Sync for SquareCoordinate
impl Unpin for SquareCoordinate
impl UnwindSafe for SquareCoordinate
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
Mutably borrows from an owned value. Read more