pub struct Move {
pub kind: Kind,
pub role: Role,
pub from: Square,
pub to: Square,
pub capture: Option<Role>,
}Expand description
Move that a player can make.
Fields§
§kind: Kind§role: Roleredundant when given the board
from: Square§to: Square§capture: Option<Role>redundant when given the board
Implementations§
Source§impl Move
Constructors
impl Move
Constructors
pub const fn normal(role: Role, from: Square, to: Square) -> Move
pub const fn capture( role: Role, from: Square, to: Square, capture: Option<Role>, ) -> Move
pub const fn chess_castle(player: Player, side: Side) -> Move
pub const fn castle(player: Player, from: Square, file: File) -> Move
pub const fn en_passant(from: Square, to: Square) -> Move
pub const fn promote(from: Square, to: Square, role: Role) -> Move
pub const fn promote_capture( from: Square, to: Square, role: Role, capture: Option<Role>, ) -> Move
pub fn pawn( player: Player, from: Square, to: Square, capture: Option<Role>, ) -> Vec<Move>
Source§impl Move
Accessors inherited from Special
impl Move
Accessors inherited from Special
pub const fn is_en_passant(self) -> bool
pub const fn is_castle(self) -> bool
pub const fn castle_rook_file(self) -> Option<File>
pub const fn is_castle_side(self, side: Side) -> bool
pub const fn castle_side(self) -> Option<Side>
pub const fn is_promote(self) -> bool
pub const fn promotes(self) -> Option<Role>
pub const fn is_promote_role(self, role: Role) -> bool
Trait Implementations§
impl Copy for Move
impl Eq for Move
Source§impl Ord for Move
impl Ord for Move
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Move
impl PartialOrd 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 UnsafeUnpin 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