Struct chess_notation_parser::Move
source · [−]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: PieceThe piece which is moving from square A to square B
dst: SquareDestination square (square B)
flags: u8Extra 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
Nonewhensrcdoesn’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 RefUnwindSafe for Move
impl Send for Move
impl Sync for Move
impl Unpin for Move
impl UnwindSafe for Move
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more