Enum myopic_board::Square[][src]

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

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, Global>[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, Global>) -> 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, Global>) -> 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.

pub fn bitand(self, other: BitBoard) -> <Square as BitAnd<BitBoard>>::Output[src]

Performs the & operation. Read more

impl BitAnd<Square> for BitBoard[src]

type Output = BitBoard

The resulting type after applying the & operator.

pub fn bitand(self, other: Square) -> BitBoard[src]

Performs the & operation. Read more

impl BitOr<BitBoard> for Square[src]

type Output = BitBoard

The resulting type after applying the | operator.

pub fn bitor(self, other: BitBoard) -> <Square as BitOr<BitBoard>>::Output[src]

Performs the | operation. Read more

impl BitOr<Square> for BitBoard[src]

type Output = BitBoard

The resulting type after applying the | operator.

pub fn bitor(self, other: Square) -> BitBoard[src]

Performs the | operation. Read more

impl BitOr<Square> for Square[src]

type Output = BitBoard

The resulting type after applying the | operator.

pub fn bitor(self, other: Square) -> <Square as BitOr<Square>>::Output[src]

Performs the | operation. Read more

impl BitOrAssign<Square> for BitBoard[src]

pub fn bitor_assign(&mut self, rhs: Square)[src]

Performs the |= operation. Read more

impl BitXor<Square> for BitBoard[src]

type Output = BitBoard

The resulting type after applying the ^ operator.

pub fn bitxor(self, rhs: Square) -> BitBoard[src]

Performs the ^ operation. Read more

impl BitXorAssign<Square> for BitBoard[src]

pub fn bitxor_assign(&mut self, rhs: Square)[src]

Performs the ^= operation. Read more

impl Clone for Square[src]

pub fn clone(&self) -> Square[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Square[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Display for Square[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl FromIterator<Square> for BitBoard[src]

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

pub fn from_iter<I>(iter: I) -> BitBoard where
    I: IntoIterator<Item = Square>, 
[src]

Creates a value from an iterator. Read more

impl FromStr for Square[src]

type Err = Error

The associated error which can be returned from parsing.

pub fn from_str(s: &str) -> Result<Square, <Square as FromStr>::Err>[src]

Parses a string s to return a value of this type. Read more

impl Hash for Square[src]

pub fn hash<__H>(&self, state: &mut __H) where
    __H: Hasher
[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl Not for Square[src]

type Output = BitBoard

The resulting type after applying the ! operator.

pub fn not(self) -> <Square as Not>::Output[src]

Performs the unary ! operation. Read more

impl Ord for Square[src]

pub fn cmp(&self, other: &Square) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Square> for Square[src]

pub fn eq(&self, other: &Square) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<Square> for Square[src]

pub fn partial_cmp(&self, other: &Square) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Reflectable for Square[src]

pub fn reflect(&self) -> Square[src]

impl Shl<usize> for Square[src]

type Output = Square

The resulting type after applying the << operator.

pub fn shl(self, rhs: usize) -> <Square as Shl<usize>>::Output[src]

Performs the << operation. Read more

impl Shr<usize> for Square[src]

type Output = Square

The resulting type after applying the >> operator.

pub fn shr(self, rhs: usize) -> <Square as Shr<usize>>::Output[src]

Performs the >> operation. Read more

impl Sub<BitBoard> for Square[src]

type Output = BitBoard

The resulting type after applying the - operator.

pub fn sub(self, other: BitBoard) -> <Square as Sub<BitBoard>>::Output[src]

Performs the - operation. Read more

impl Sub<Square> for BitBoard[src]

type Output = BitBoard

The resulting type after applying the - operator.

pub fn sub(self, other: Square) -> BitBoard[src]

Performs the - operation. Read more

impl Copy for Square[src]

impl Eq for Square[src]

impl StructuralEq for Square[src]

impl StructuralPartialEq for Square[src]

Auto Trait Implementations

impl RefUnwindSafe for Square

impl Send for Square

impl Sync for Square

impl Unpin for Square

impl UnwindSafe for Square

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T

Notable traits for &'_ mut I

impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;
[src]

Immutably borrows from an owned value. Read more

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

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

Notable traits for &'_ mut I

impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;
[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.