Struct minorhacks_chess::ChessMove [−][src]
pub struct ChessMove { /* fields omitted */ }
Represent a ChessMove in memory
Implementations
impl ChessMove
[src]
impl ChessMove
[src]pub fn new(source: Square, dest: Square, promotion: Option<Piece>) -> ChessMove
[src]
pub fn new(source: Square, dest: Square, promotion: Option<Piece>) -> ChessMove
[src]Create a new chess move, given a source Square
, a destination Square
, and an optional
promotion Piece
pub fn get_source(&self) -> Square
[src]
pub fn get_source(&self) -> Square
[src]Get the source square (square the piece is currently on).
pub fn get_promotion(&self) -> Option<Piece>
[src]
pub fn get_promotion(&self) -> Option<Piece>
[src]Get the promotion piece (maybe).
pub fn from_san(board: &Board, move_text: &str) -> Result<ChessMove, Error>
[src]
pub fn from_san(board: &Board, move_text: &str) -> Result<ChessMove, Error>
[src]Convert a SAN (Standard Algebraic Notation) move into a ChessMove
use minorhacks_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
impl FromStr for ChessMove
[src]
impl FromStr for ChessMove
[src]Convert a UCI String
to a move. If invalid, return None
use minorhacks_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);
impl Ord for ChessMove
[src]
impl Ord for ChessMove
[src]impl PartialOrd<ChessMove> for ChessMove
[src]
impl PartialOrd<ChessMove> for ChessMove
[src]fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for ChessMove
[src]
impl Eq for ChessMove
[src]
impl StructuralEq for ChessMove
[src]
impl StructuralPartialEq for ChessMove
[src]
Auto Trait Implementations
impl RefUnwindSafe for ChessMove
impl Send for ChessMove
impl Sync for ChessMove
impl Unpin for ChessMove
impl UnwindSafe for ChessMove
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more