Enum shakmaty::Move
[−]
[src]
pub enum Move { Normal { role: Role, from: Square, capture: Option<Role>, to: Square, promotion: Option<Role>, }, EnPassant { from: Square, to: Square, }, Castle { king: Square, rook: Square, }, Put { role: Role, to: Square, }, }
Information about a move.
Variants
Normal
Fields of Normal
role: Role | |
from: Square | |
capture: Option<Role> | |
to: Square | |
promotion: Option<Role> |
EnPassant
Fields of EnPassant
from: Square | |
to: Square |
Castle
Fields of Castle
king: Square | |
rook: Square |
Put
Fields of Put
role: Role | |
to: Square |
Methods
impl Move
[src]
fn role(&self) -> Role
[src]
Gets the role of the moved piece.
fn from(&self) -> Option<Square>
[src]
Gets the origin square or None
for drops.
fn to(&self) -> Square
[src]
Gets the target square. For castling moves this is the corresponding rook square.
fn capture(&self) -> Option<Role>
[src]
Gets the role of the captured piece or None
.
fn is_capture(&self) -> bool
[src]
Checks if the move is a capture.
fn is_en_passant(&self) -> bool
[src]
Checks if the move is en passant.
fn castling_side(&self) -> Option<CastlingSide>
[src]
Gets the castling side.
fn is_castle(&self) -> bool
[src]
Checks if the move is a castling move.
fn promotion(&self) -> Option<Role>
[src]
Gets the promotion role.
fn is_promotion(&self) -> bool
[src]
Checks if the move is a promotion.
Trait Implementations
impl Clone for Move
[src]
fn clone(&self) -> Move
[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 Eq for Move
[src]
impl PartialEq for Move
[src]
fn eq(&self, __arg_0: &Move) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Move) -> bool
[src]
This method tests for !=
.