Enum shogi::piece_type::PieceType
[−]
[src]
pub enum PieceType { King, Rook, Bishop, Gold, Silver, Knight, Lance, Pawn, ProRook, ProBishop, ProSilver, ProKnight, ProLance, ProPawn, }
Represents a kind of pieces.
Variants
King
Rook
Bishop
Gold
Silver
Knight
Lance
Pawn
ProRook
ProBishop
ProSilver
ProKnight
ProLance
ProPawn
Methods
impl PieceType
[src]
fn iter() -> PieceTypeIter
Returns an iterator over all variants.
fn from_sfen(c: char) -> Option<PieceType>
Creates a new instance of PieceType
from SFEN formatted string.
fn promote(&self) -> Option<PieceType>
Returns an instance of PieceType
after promotion.
Examples
use shogi::PieceType; assert_eq!(Some(PieceType::ProPawn), PieceType::Pawn.promote()); assert_eq!(None, PieceType::ProPawn.promote());
fn unpromote(&self) -> Option<PieceType>
Returns an instance of PieceType
before promotion.
Examples
use shogi::PieceType; assert_eq!(Some(PieceType::Pawn), PieceType::ProPawn.unpromote()); assert_eq!(None, PieceType::Pawn.unpromote());
fn is_hand_piece(&self) -> bool
Checks if this piece type can be a part of hand pieces.
fn index(&self) -> usize
Converts the instance into the unique number for array indexing purpose.
Trait Implementations
impl Debug for PieceType
[src]
impl PartialEq for PieceType
[src]
fn eq(&self, __arg_0: &PieceType) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for PieceType
[src]
impl Clone for PieceType
[src]
fn clone(&self) -> PieceType
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more