Trait SquareTrait

Source
pub trait SquareTrait {
    // Required methods
    fn from_uci(uci: String) -> (Square, bool);
    fn rank(self) -> Rank;
    fn file(self) -> File;
    fn uci(self) -> String;
    fn bitboard(self) -> Bitboard;
    fn add_delta(self, delta: &Delta) -> (Square, bool);
    fn add_delta_occup(self, delta: &Delta, occup: Bitboard) -> (Square, bool);
}
Expand description

Square trait adds methods to a Square

Required Methods§

Source

fn from_uci(uci: String) -> (Square, bool)

creates Square from uci

Source

fn rank(self) -> Rank

returns the rank of the square

Source

fn file(self) -> File

returns the file of the square

Source

fn uci(self) -> String

returns the UCI representation of the square

Source

fn bitboard(self) -> Bitboard

returns an otherwise empty bitboard with the bit for this square set

Source

fn add_delta(self, delta: &Delta) -> (Square, bool)

adds a delta to a square and returns the resulting square together with a bool indicating whether adding was a success

Source

fn add_delta_occup(self, delta: &Delta, occup: Bitboard) -> (Square, bool)

same as add_delta, but also fails if the resulting square is occupied

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SquareTrait for Square

SquareTrait adds methods to a Square