pub struct Move {
pub data: u16,
}
Fields§
§data: u16
Implementations§
source§impl Move
impl Move
sourcepub fn new(from: usize, to: usize, flags: u8) -> Self
pub fn new(from: usize, to: usize, flags: u8) -> Self
Constructs a new instance of Move with stored from
, to
and flags
.
sourcepub const fn new_from_raw(data: u16) -> Self
pub const fn new_from_raw(data: u16) -> Self
Constructs a new instance of Move using raw bits, which will be directly used as a data.
sourcepub fn new_random() -> Self
pub fn new_random() -> Self
Constructs a new instance of Move with random values, not restricted by chess rules.
sourcepub fn get_promotion_piece(&self) -> usize
pub fn get_promotion_piece(&self) -> usize
Gets promotion piece based on the flags saved in the internal data.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks if there is any data present or it’s just a default move.
sourcepub fn is_single_push(&self) -> bool
pub fn is_single_push(&self) -> bool
Checks if the move is a single push.
sourcepub fn is_double_push(&self) -> bool
pub fn is_double_push(&self) -> bool
Checks if the move is a double push.
sourcepub fn is_capture(&self) -> bool
pub fn is_capture(&self) -> bool
Checks if the move is a capture (excluding en passant, but including promotions).
sourcepub fn is_en_passant(&self) -> bool
pub fn is_en_passant(&self) -> bool
Checks if the move is en passant.
sourcepub fn is_promotion(&self) -> bool
pub fn is_promotion(&self) -> bool
Checks if the move is a promotion (including captures).
sourcepub fn is_castling(&self) -> bool
pub fn is_castling(&self) -> bool
Checks if the move is a short or long castling.
Trait Implementations§
source§impl PartialEq for Move
impl PartialEq for Move
impl Copy for Move
impl Eq for Move
impl StructuralPartialEq for Move
Auto Trait Implementations§
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