Trait cetkaik_traits::IsBoard
source · pub trait IsBoard {
type PieceWithSide: Copy;
type Coord: Copy + Debug;
type EmptySquaresIter: Iterator<Item = Self::Coord>;
fn peek(&self, c: Self::Coord) -> Option<Self::PieceWithSide>;
fn pop(&mut self, c: Self::Coord) -> Option<Self::PieceWithSide>;
fn put(&mut self, c: Self::Coord, p: Option<Self::PieceWithSide>);
fn assert_empty(&self, c: Self::Coord);
fn assert_occupied(&self, c: Self::Coord);
fn empty_squares(&self) -> Self::EmptySquaresIter;
fn mov(&mut self, from: Self::Coord, to: Self::Coord) { ... }
}
Expand description
A trait that signifies that you can use it as a Board
/Board
として扱える型を表すトレイト
Required Associated Types§
sourcetype PieceWithSide: Copy
type PieceWithSide: Copy
A type that represents the piece
type EmptySquaresIter: Iterator<Item = Self::Coord>
Required Methods§
sourcefn peek(&self, c: Self::Coord) -> Option<Self::PieceWithSide>
fn peek(&self, c: Self::Coord) -> Option<Self::PieceWithSide>
peek
sourcefn pop(&mut self, c: Self::Coord) -> Option<Self::PieceWithSide>
fn pop(&mut self, c: Self::Coord) -> Option<Self::PieceWithSide>
pop
sourcefn put(&mut self, c: Self::Coord, p: Option<Self::PieceWithSide>)
fn put(&mut self, c: Self::Coord, p: Option<Self::PieceWithSide>)
put either a piece or a None
sourcefn assert_empty(&self, c: Self::Coord)
fn assert_empty(&self, c: Self::Coord)
assert that the square is empty
sourcefn assert_occupied(&self, c: Self::Coord)
fn assert_occupied(&self, c: Self::Coord)
assert that the square is occupied