pub struct Move {
pub who: Piece,
pub dst: Square,
pub flags: u8,
pub src: Option<Vec<Square>>,
pub promotion: Option<Piece>,
}
Expand description
§Move turn
Move
struct represents any chess turn in which piece is moved from square
A to square B, with some additional information.
Move
can represent any chess turn expect for castling. Castling is
described separately within ‘Castling’ struct.
§Example
use chess_notation_parser::{Turn, Move, Square, Piece, Flag};
let turn = Turn::Move(
Move {
who: Piece::Pawn,
dst: Square::C3,
flags: Flag::NONE,
src: None,
promotion: None,
}
);
assert_eq!(turn, Turn::try_from("c3").unwrap());
Fields§
§who: Piece
The piece which is moving from square A to square B
dst: Square
Destination square (square B)
flags: u8
Extra bits of information stored in a bitmask about the turn, check
Flag
for more info
src: Option<Vec<Square>>
Description of a square A
- Can be a specific square
- Can be a rank or a file. In that case it is a set of 8 squares
- Can be
None
whensrc
doesn’t need to be provided
promotion: Option<Piece>
The Piece
to which pawns are promoted to
Trait Implementations§
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