Trait cetkaik_traits::IsField
source · pub trait IsField {
type Board: IsBoard<PieceWithSide = Self::PieceWithSide, Coord = Self::Coord>;
type Coord: Eq + Debug;
type PieceWithSide;
type Side;
fn move_nontam_piece_from_src_to_dest_while_taking_opponent_piece_if_needed(
&self,
from: Self::Coord,
to: Self::Coord,
whose_turn: Self::Side
) -> Result<Self, &'static str>
where
Self: Sized;
fn search_from_hop1zuo1_and_parachute_at(
&self,
color: Color,
prof: Profession,
side: Self::Side,
dest: Self::Coord
) -> Option<Self>
where
Self: Sized;
fn as_board(&self) -> &Self::Board;
fn as_board_mut(&mut self) -> &mut Self::Board;
}
Expand description
A trait that signifies that you can use it as a Field
/Field
として扱える型を表すトレイト
Required Associated Types§
sourcetype Board: IsBoard<PieceWithSide = Self::PieceWithSide, Coord = Self::Coord>
type Board: IsBoard<PieceWithSide = Self::PieceWithSide, Coord = Self::Coord>
A type that represents the board
sourcetype PieceWithSide
type PieceWithSide
A type that represents the piece
Required Methods§
sourcefn move_nontam_piece_from_src_to_dest_while_taking_opponent_piece_if_needed(
&self,
from: Self::Coord,
to: Self::Coord,
whose_turn: Self::Side
) -> Result<Self, &'static str>where
Self: Sized,
fn move_nontam_piece_from_src_to_dest_while_taking_opponent_piece_if_needed(
&self,
from: Self::Coord,
to: Self::Coord,
whose_turn: Self::Side
) -> Result<Self, &'static str>where
Self: Sized,
Moving a piece and taking it if necessary
Errors
from
is unoccupiedfrom
has Tam2to
has Tam2from
does not belong towhose_turn
sourcefn search_from_hop1zuo1_and_parachute_at(
&self,
color: Color,
prof: Profession,
side: Self::Side,
dest: Self::Coord
) -> Option<Self>where
Self: Sized,
fn search_from_hop1zuo1_and_parachute_at(
&self,
color: Color,
prof: Profession,
side: Self::Side,
dest: Self::Coord
) -> Option<Self>where
Self: Sized,
Remove a specified piece from one’s hop1zuo1 and place it at dest
;
if none is found, or if dest
is already occupied, return None
.
/手駒から指定の駒を削除し、盤面に置く。指定の駒が手駒に見当たらないか、dest
が既に埋まっているなら None
。
sourcefn as_board_mut(&mut self) -> &mut Self::Board
fn as_board_mut(&mut self) -> &mut Self::Board
Mutably borrows the board