[][src]Struct pleco::board::piece_locations::PieceLocations

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]

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]

Removes a Square.

Panics

Panics if Square is of index higher than 63.

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 PartialEq<PieceLocations> for PieceLocations[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for PieceLocations[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

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?

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.