SquareCoordinate

Enum SquareCoordinate 

Source
#[repr(u8)]
pub enum SquareCoordinate {
Show 65 variants A8 = 0, B8 = 1, C8 = 2, D8 = 3, E8 = 4, F8 = 5, G8 = 6, H8 = 7, A7 = 16, B7 = 17, C7 = 18, D7 = 19, E7 = 20, F7 = 21, G7 = 22, H7 = 23, A6 = 32, B6 = 33, C6 = 34, D6 = 35, E6 = 36, F6 = 37, G6 = 38, H6 = 39, A5 = 48, B5 = 49, C5 = 50, D5 = 51, E5 = 52, F5 = 53, G5 = 54, H5 = 55, A4 = 64, B4 = 65, C4 = 66, D4 = 67, E4 = 68, F4 = 69, G4 = 70, H4 = 71, A3 = 80, B3 = 81, C3 = 82, D3 = 83, E3 = 84, F3 = 85, G3 = 86, H3 = 87, A2 = 96, B2 = 97, C2 = 98, D2 = 99, E2 = 100, F2 = 101, G2 = 102, H2 = 103, A1 = 112, B1 = 113, C1 = 114, D1 = 115, E1 = 116, F1 = 117, G1 = 118, H1 = 119, __BAD_COORD = 200,
}

Variants§

§

A8 = 0

§

B8 = 1

§

C8 = 2

§

D8 = 3

§

E8 = 4

§

F8 = 5

§

G8 = 6

§

H8 = 7

§

A7 = 16

§

B7 = 17

§

C7 = 18

§

D7 = 19

§

E7 = 20

§

F7 = 21

§

G7 = 22

§

H7 = 23

§

A6 = 32

§

B6 = 33

§

C6 = 34

§

D6 = 35

§

E6 = 36

§

F6 = 37

§

G6 = 38

§

H6 = 39

§

A5 = 48

§

B5 = 49

§

C5 = 50

§

D5 = 51

§

E5 = 52

§

F5 = 53

§

G5 = 54

§

H5 = 55

§

A4 = 64

§

B4 = 65

§

C4 = 66

§

D4 = 67

§

E4 = 68

§

F4 = 69

§

G4 = 70

§

H4 = 71

§

A3 = 80

§

B3 = 81

§

C3 = 82

§

D3 = 83

§

E3 = 84

§

F3 = 85

§

G3 = 86

§

H3 = 87

§

A2 = 96

§

B2 = 97

§

C2 = 98

§

D2 = 99

§

E2 = 100

§

F2 = 101

§

G2 = 102

§

H2 = 103

§

A1 = 112

§

B1 = 113

§

C1 = 114

§

D1 = 115

§

E1 = 116

§

F1 = 117

§

G1 = 118

§

H1 = 119

§

__BAD_COORD = 200

Implementations§

Source§

impl SquareCoordinate

Source

pub fn to_index(&self) -> usize

Convert a Square enum to its associated value (A8 = 0, B8 = 1, etc.)

Source

pub fn to_san(&self) -> String

Convert square to standard algebraic notation

Source

pub fn is_light_sq(&self) -> bool

Source

pub fn is_dark_sq(&self) -> bool

Source

pub fn rank(&self) -> u8

Source

pub fn file(&self) -> u8

Source

pub fn above(&self) -> Result<Self, ChessError>

Source

pub fn below(&self) -> Result<Self, ChessError>

Source

pub fn left(&self) -> Result<Self, ChessError>

Source

pub fn right(&self) -> Result<Self, ChessError>

Source

pub fn upper_left(&self) -> Result<Self, ChessError>

Source

pub fn upper_right(&self) -> Result<Self, ChessError>

Source

pub fn lower_left(&self) -> Result<Self, ChessError>

Source

pub fn lower_right(&self) -> Result<Self, ChessError>

Source

pub fn subtract(&self, rhs: usize) -> Result<Self, ChessError>

Trait Implementations§

Source§

impl Clone for SquareCoordinate

Source§

fn clone(&self) -> SquareCoordinate

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SquareCoordinate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SquareCoordinate

Source§

fn eq(&self, other: &SquareCoordinate) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SquareCoordinate

Source§

impl Eq for SquareCoordinate

Source§

impl StructuralPartialEq for SquareCoordinate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.