#[repr(align(4))]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,
},
}
Expand description
Variants§
Normal
A normal move, e.g., Bd3xh7
.
EnPassant
An en passant capture, e.g., e5xd6
.
Castle
A castling move, O-O
or O-O-O
.
Put
A piece drop in Crazyhouse, e.g., Q@g8
.
Implementations§
source§impl Move
impl Move
sourcepub const fn to(&self) -> Square
pub const fn to(&self) -> Square
Gets the target square. For castling moves this is the corresponding rook square.
sourcepub const fn is_capture(&self) -> bool
pub const fn is_capture(&self) -> bool
Checks if the move is a capture.
sourcepub const fn is_en_passant(&self) -> bool
pub const fn is_en_passant(&self) -> bool
Checks if the move is en passant.
sourcepub const fn is_zeroing(&self) -> bool
pub const fn is_zeroing(&self) -> bool
Checks if the move zeros the half-move clock.
sourcepub fn castling_side(&self) -> Option<CastlingSide>
pub fn castling_side(&self) -> Option<CastlingSide>
Gets the castling side.
sourcepub const fn is_promotion(&self) -> bool
pub const fn is_promotion(&self) -> bool
Checks if the move is a promotion.
source§impl Move
impl Move
sourcepub fn to_uci(&self, mode: CastlingMode) -> Uci
pub fn to_uci(&self, mode: CastlingMode) -> Uci
See Uci::from_move()
.
Trait Implementations§
source§impl PartialEq for Move
impl PartialEq for Move
impl Eq for Move
impl StructuralPartialEq for Move
Auto Trait Implementations§
impl Freeze for Move
impl RefUnwindSafe for Move
impl Send for Move
impl Sync for Move
impl Unpin for Move
impl UnwindSafe for Move
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more