pub struct RetroPocket {
pub pawn: u8,
pub knight: u8,
pub bishop: u8,
pub rook: u8,
pub queen: u8,
pub unpromotion: u8,
}Expand description
A RetroBoard pocket with a counter for each piece type.
It stores the pieces than can be uncaptured by each color.
self.unpromotion is the number of pieces than can unpromote into a pawn.
By default it is set to 0
Fields§
§pawn: u8§knight: u8§bishop: u8§rook: u8§queen: u8§unpromotion: u8Implementations§
Trait Implementations§
Source§impl Clone for RetroPocket
impl Clone for RetroPocket
Source§fn clone(&self) -> RetroPocket
fn clone(&self) -> RetroPocket
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetroPocket
impl Debug for RetroPocket
Source§impl FromStr for RetroPocket
impl FromStr for RetroPocket
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Returns a RetroPocket taking a string which contains as many letters representing the piece Role in standard annotation, and a single number for the number of promotion, if any.
§Examples
use std::str::FromStr;
use retroboard::RetroPocket;
let retro_pocket = RetroPocket::from_str("PPPQNB6").unwrap();
assert_eq!(retro_pocket.pawn, 3);
assert_eq!(retro_pocket.queen, 1);
assert_eq!(retro_pocket.knight, 1);
assert_eq!(retro_pocket.bishop, 1);
assert_eq!(retro_pocket.unpromotion, 6);Source§type Err = ParseRetroPocketError
type Err = ParseRetroPocketError
The associated error which can be returned from parsing.
Source§impl Hash for RetroPocket
impl Hash for RetroPocket
Source§impl IntoIterator for RetroPocket
impl IntoIterator for RetroPocket
Source§impl PartialEq for RetroPocket
impl PartialEq for RetroPocket
impl Eq for RetroPocket
impl StructuralPartialEq for RetroPocket
Auto Trait Implementations§
impl Freeze for RetroPocket
impl RefUnwindSafe for RetroPocket
impl Send for RetroPocket
impl Sync for RetroPocket
impl Unpin for RetroPocket
impl UnwindSafe for RetroPocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more