Struct bughouse::ChessMove [−][src]
pub struct ChessMove { /* fields omitted */ }
Expand description
Represent a ChessMove in memory
Implementations
Create a new chess move, given a source Square
, a destination Square
, and an optional
promotion Piece
Get the source square (square the piece is currently on).
Get the promotion piece (maybe).
Convert a SAN (Standard Algebraic Notation) move into a ChessMove
use chess::{Board, ChessMove, Square}; let board = Board::default(); assert_eq!( ChessMove::from_san(&board, "e4").expect("e4 is valid in the initial position"), ChessMove::new(Square::E2, Square::E4, None) );
Trait Implementations
Convert a UCI String
to a move. If invalid, return None
use chess::{ChessMove, Square, Piece}; use std::str::FromStr; let mv = ChessMove::new(Square::E7, Square::E8, Some(Piece::Queen)); assert_eq!(ChessMove::from_str("e7e8q").expect("Valid Move"), mv);
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for ChessMove
impl UnwindSafe for ChessMove
Blanket Implementations
Mutably borrows from an owned value. Read more