Struct pleco::board::piece_locations::PieceLocations [−][src]
pub struct PieceLocations { /* fields omitted */ }
Struct to allow fast lookups for any square. Given a square, allows for determining if there is a piece currently there, and if so, allows for determining it's color and type of piece.
Piece Locations is a BLIND structure, Providing a function of |sq| -> |Piece AND/OR Player| The reverse cannot be done Looking up squares from a piece / player.
Methods
impl PieceLocations
[src]
impl PieceLocations
pub const fn blank() -> PieceLocations
[src]
pub const fn blank() -> PieceLocations
Constructs a new PieceLocations
with a default of no pieces on the board.
pub fn place(&mut self, square: SQ, player: Player, piece: PieceType)
[src]
pub fn place(&mut self, square: SQ, player: Player, piece: PieceType)
Places a given piece for a given player at a certain square.
Panics
Panics if Square is of index higher than 63.
pub fn remove(&mut self, square: SQ)
[src]
pub fn remove(&mut self, square: SQ)
pub fn piece_at(&self, square: SQ) -> Piece
[src]
pub fn piece_at(&self, square: SQ) -> Piece
Returns the Piece at a SQ
, Or None if the square is empty.
Panics
Panics if square is of index higher than 63.
pub fn at_square(&self, square: SQ) -> bool
[src]
pub fn at_square(&self, square: SQ) -> bool
Returns if a square is occupied.
pub fn first_square(&self, piece: PieceType, player: Player) -> Option<SQ>
[src]
pub fn first_square(&self, piece: PieceType, player: Player) -> Option<SQ>
Returns the first square (if any) that a piece / player is at.
pub fn contains(&self, piece: PieceType, player: Player) -> bool
[src]
pub fn contains(&self, piece: PieceType, player: Player) -> bool
Returns if the Board contains a particular piece / player.
Trait Implementations
impl Clone for PieceLocations
[src]
impl Clone for PieceLocations
fn clone(&self) -> PieceLocations
[src]
fn clone(&self) -> PieceLocations
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for PieceLocations
[src]
impl PartialEq for PieceLocations
fn eq(&self, other: &PieceLocations) -> bool
[src]
fn eq(&self, other: &PieceLocations) -> 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[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl IntoIterator for PieceLocations
[src]
impl IntoIterator for PieceLocations
Auto Trait Implementations
impl Send for PieceLocations
impl Send for PieceLocations
impl Sync for PieceLocations
impl Sync for PieceLocations