Struct chess::Square[][src]

pub struct Square(_);

Represent a square on the chess board

Methods

impl Square
[src]

Create a new square, given an index. Note: It is invalid, but allowed, to pass in a number >= 64. Doing so will crash stuff.

Make a square given a rank and a file

Return the rank given this square.

Return the file given this square.

If there is a square above me, return that. Otherwise, None.

If there is a square below me, return that. Otherwise, None.

If there is a square to the left of me, return that. Otherwise, None.

If there is a square to the right of me, return that. Otherwise, None.

If there is a square "forward", given my Color, go in that direction. Otherwise, None.

If there is a square "backward" given my Color, go in that direction. Otherwise, None.

If there is a square above me, return that. If not, wrap around to the other side.

If there is a square below me, return that. If not, wrap around to the other side.

If there is a square to the left of me, return that. If not, wrap around to the other side.

If there is a square to the right of me, return that. If not, wrap around to the other side.

If there is a square "forward", given my color, return that. If not, wrap around to the other side.

If there is a square "backward", given my color, return that. If not, wrap around to the other side.

Convert this square to an integer.

Convert this Square to a usize for table lookup purposes

Convert a UCI String to a square. If invalid, return None

Trait Implementations

impl PartialEq for Square
[src]

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

This method tests for !=.

impl Ord for Square
[src]

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Eq for Square
[src]

impl PartialOrd for Square
[src]

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

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

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

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

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

impl Copy for Square
[src]

impl Clone for Square
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Display for Square
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Square

impl Sync for Square