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]
impl Move
pub fn role(&self) -> Role
[src]
pub fn role(&self) -> Role
Gets the role of the moved piece.
pub fn from(&self) -> Option<Square>
[src]
pub fn from(&self) -> Option<Square>
Gets the origin square or None
for drops.
pub fn to(&self) -> Square
[src]
pub fn to(&self) -> Square
Gets the target square. For castling moves this is the corresponding rook square.
pub fn capture(&self) -> Option<Role>
[src]
pub fn capture(&self) -> Option<Role>
Gets the role of the captured piece or None
.
pub fn is_capture(&self) -> bool
[src]
pub fn is_capture(&self) -> bool
Checks if the move is a capture.
pub fn is_en_passant(&self) -> bool
[src]
pub fn is_en_passant(&self) -> bool
Checks if the move is en passant.
pub fn is_zeroing(&self) -> bool
[src]
pub fn is_zeroing(&self) -> bool
Checks if the move zeros the half-move clock.
pub fn castling_side(&self) -> Option<CastlingSide>
[src]
pub fn castling_side(&self) -> Option<CastlingSide>
Gets the castling side.
pub fn is_castle(&self) -> bool
[src]
pub fn is_castle(&self) -> bool
Checks if the move is a castling move.
pub fn promotion(&self) -> Option<Role>
[src]
pub fn promotion(&self) -> Option<Role>
Gets the promotion role.
pub fn is_promotion(&self) -> bool
[src]
pub fn is_promotion(&self) -> bool
Checks if the move is a promotion.
Trait Implementations
impl Clone for Move
[src]
impl Clone for Move
fn clone(&self) -> Move
[src]
fn clone(&self) -> Move
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Eq for Move
[src]
impl Eq for Move
impl PartialEq for Move
[src]
impl PartialEq for Move
fn eq(&self, other: &Move) -> bool
[src]
fn eq(&self, other: &Move) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Move) -> bool
[src]
fn ne(&self, other: &Move) -> bool
This method tests for !=
.
impl Debug for Move
[src]
impl Debug for Move
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Move
[src]
impl Display for Move