[][src]Enum myopic_core::Square

pub enum Square {
    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,
}

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

impl Square[src]

pub fn iter() -> impl Iterator<Item = Square>[src]

Return an iterator traversing all squares in order.

pub fn from_index(i: usize) -> Square[src]

Retrieve a square by it's corresponding index.

pub const fn rank_index(self) -> usize[src]

Return the index of the rank on which this square resides.

pub const fn file_index(self) -> usize[src]

Return the index of the file on which this square resides.

pub fn rank(self) -> BitBoard[src]

Return a bitboard representing the rank on which this square resides.

pub fn file(self) -> BitBoard[src]

Return a bitboard representing the file on which this square resides.

pub const fn lift(self) -> BitBoard[src]

'Lifts' this square to a singleton set of squares.

pub fn next(self, dir: Dir) -> Option<Square>[src]

Finds the next square on a chessboard from this square in a given direction if it exists.

pub fn search(self, dir: Dir) -> BitBoard[src]

Find all squares in a given direction from this square and returns them as a set.

pub fn search_vec(self, dir: Dir) -> Vec<Square>[src]

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.

pub fn search_all(self, dirs: &Vec<Dir>) -> BitBoard[src]

Find all squares in all directions in a given vector and returns them as a set.

pub fn search_one(self, dirs: &Vec<Dir>) -> BitBoard[src]

Find the squares adjacent to this square in all of the given directions and returns them as a set.

Trait Implementations

impl BitAnd<BitBoard> for Square[src]

type Output = BitBoard

The resulting type after applying the & operator.

impl BitAnd<Square> for BitBoard[src]

type Output = Self

The resulting type after applying the & operator.

impl BitOr<BitBoard> for Square[src]

type Output = BitBoard

The resulting type after applying the | operator.

impl BitOr<Square> for BitBoard[src]

type Output = Self

The resulting type after applying the | operator.

impl BitOr<Square> for Square[src]

type Output = BitBoard

The resulting type after applying the | operator.

impl BitOrAssign<Square> for BitBoard[src]

impl BitXor<Square> for BitBoard[src]

type Output = Self

The resulting type after applying the ^ operator.

impl BitXorAssign<Square> for BitBoard[src]

impl Clone for Square[src]

impl Copy for Square[src]

impl Debug for Square[src]

impl Display for Square[src]

impl Eq for Square[src]

impl FromIterator<Square> for BitBoard[src]

A set of squares can be built from an iterator traversing squares.

impl FromStr for Square[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Square[src]

impl Not for Square[src]

type Output = BitBoard

The resulting type after applying the ! operator.

impl Ord for Square[src]

impl PartialEq<Square> for Square[src]

impl PartialOrd<Square> for Square[src]

impl Reflectable for Square[src]

impl Shl<usize> for Square[src]

type Output = Square

The resulting type after applying the << operator.

impl Shr<usize> for Square[src]

type Output = Square

The resulting type after applying the >> operator.

impl StructuralEq for Square[src]

impl StructuralPartialEq for Square[src]

impl Sub<BitBoard> for Square[src]

type Output = BitBoard

The resulting type after applying the - operator.

impl Sub<Square> for BitBoard[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.