Struct hexe_core::mv::Move [] [src]

pub struct Move(_);

A chess piece move from one square to another.

Each instance has the following memory layout:

Methods

impl Move
[src]

[src]

Creates a new Move from one square to another.

[src]

Creates a new promotion move for color at file.

[src]

Creates a new castle move for right.

[src]

Creates an en passant move from one square to another.

[src]

Returns whether the squares of self equal the squares of other.

[src]

Returns the source square for self.

[src]

Returns the destination square for self.

[src]

Returns the kind for self.

[src]

Returns self a castle move if it can be converted into one.

[src]

Returns self as an en passant move if it can be converted into one.

[src]

Returns a match-able type that represents the inner variant of self.

Examples

Basic usage:

use hexe_core::mv::{Move, Matches};
use hexe_core::square::Square;

let mv = Move::normal(Square::A1, Square::A7);

match mv.matches() {
    Matches::Normal(mv)    => println!("{:?}", mv.src()),
    Matches::Castle(mv)    => println!("{:?}", mv.right()),
    Matches::Promotion(mv) => println!("{:?}", mv.piece()),
    Matches::EnPassant(mv) => println!("{:?}", mv.capture()),
}

Trait Implementations

impl From<Normal> for Move
[src]

[src]

Performs the conversion.

impl FromUnchecked<Move> for Normal
[src]

[src]

Performs the unchecked conversion.

impl AsRef<Move> for Normal
[src]

[src]

Performs the conversion.

impl From<Castle> for Move
[src]

[src]

Performs the conversion.

impl FromUnchecked<Move> for Castle
[src]

[src]

Performs the unchecked conversion.

impl AsRef<Move> for Castle
[src]

[src]

Performs the conversion.

impl From<Promotion> for Move
[src]

[src]

Performs the conversion.

impl FromUnchecked<Move> for Promotion
[src]

[src]

Performs the unchecked conversion.

impl AsRef<Move> for Promotion
[src]

[src]

Performs the conversion.

impl From<EnPassant> for Move
[src]

[src]

Performs the conversion.

impl FromUnchecked<Move> for EnPassant
[src]

[src]

Performs the unchecked conversion.

impl AsRef<Move> for EnPassant
[src]

[src]

Performs the conversion.

impl From<Right> for Move
[src]

[src]

Performs the conversion.

impl PartialEq for Move
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for Move
[src]

impl Clone for Move
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Move
[src]

impl Hash for Move
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl FromUnchecked<u16> for Move
[src]

[src]

Performs the unchecked conversion.

impl From<Move> for u16
[src]

[src]

Performs the conversion.

impl Debug for Move
[src]

[src]

Formats the value using the given formatter. Read more

impl From<Move> for Matches
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Move

impl Sync for Move