Enum shuuro::piece_type::PieceType
source · [−]pub enum PieceType {
King,
Queen,
Rook,
Bishop,
Knight,
Pawn,
Plinth,
}
Expand description
Represents a kind of pieces.
Variants
King
Queen
Rook
Bishop
Knight
Pawn
Plinth
Implementations
sourceimpl PieceType
impl PieceType
sourcepub fn iter() -> PieceTypeIterⓘNotable traits for PieceTypeIterimpl Iterator for PieceTypeIter type Item = PieceType;
pub fn iter() -> PieceTypeIterⓘNotable traits for PieceTypeIterimpl Iterator for PieceTypeIter type Item = PieceType;
Returns an iterator over all variants.
sourcepub fn from_sfen(c: char) -> Option<PieceType>
pub fn from_sfen(c: char) -> Option<PieceType>
Creates a new instance of PieceType
from SFEN formatted string.
sourcepub fn promote(self) -> Option<PieceType>
pub fn promote(self) -> Option<PieceType>
Returns an instance of PieceType
after promotion.
Examples
use shuuro::PieceType;
assert_eq!(Some(PieceType::Queen), PieceType::Pawn.promote());
sourcepub fn unpromote(self) -> Option<PieceType>
pub fn unpromote(self) -> Option<PieceType>
Returns an instance of PieceType
before promotion.
Examples
use shuuro::PieceType;
assert_eq!(Some(PieceType::Pawn), PieceType::Queen.unpromote());
assert_eq!(None, PieceType::Pawn.unpromote());
sourcepub fn is_hand_piece(self) -> bool
pub fn is_hand_piece(self) -> bool
Checks if this piece type can be a part of hand pieces.
Trait Implementations
impl Copy for PieceType
impl Eq for PieceType
impl StructuralEq for PieceType
impl StructuralPartialEq for PieceType
Auto Trait Implementations
impl RefUnwindSafe for PieceType
impl Send for PieceType
impl Sync for PieceType
impl Unpin for PieceType
impl UnwindSafe for PieceType
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more