[−][src]Struct pleco::board::piece_locations::PieceLocations
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]
pub const fn blank() -> PieceLocations
[src]
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]
Places a given piece for a given player at a certain square.
Panics
Panics if Square is of index higher than 63 or the piece is PieceType::{None || All}
pub fn remove(&mut self, square: SQ)
[src]
pub fn piece_at(&self, square: SQ) -> Piece
[src]
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]
Returns if a square is occupied.
pub fn first_square(&self, piece: PieceType, player: Player) -> Option<SQ>
[src]
Returns the first square (if any) that a piece / player is at.
pub fn contains(&self, piece: PieceType, player: Player) -> bool
[src]
Returns if the Board contains a particular piece / player.
Trait Implementations
impl IntoIterator for PieceLocations
[src]
type Item = (SQ, Piece)
The type of the elements being iterated over.
type IntoIter = PieceLocationsIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Clone for PieceLocations
[src]
fn clone(&self) -> PieceLocations
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<PieceLocations> for PieceLocations
[src]
Auto Trait Implementations
impl Send for PieceLocations
impl Sync for PieceLocations
Blanket Implementations
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,