Struct chess_computer::fen::Fen
source · pub struct Fen {
piece_placement: [[Option<(PieceColor, PieceType)>; 8]; 8],
active_color: PieceColor,
castling_rights: CastlingRights,
ep_target_square: Option<BoardPosition>,
halfmove_clock: i32,
fullmove_number: i32,
}Expand description
A representation of a board state based on FEN notation.
Fields§
§piece_placement: [[Option<(PieceColor, PieceType)>; 8]; 8]The piece placement.
active_color: PieceColorThe active color.
castling_rights: CastlingRightsThe castling rights.
ep_target_square: Option<BoardPosition>A square over which a pawn has just passed after moving two squares, if available.
halfmove_clock: i32The number of halfmoves since the last capture or pawn advance.
fullmove_number: i32The number of the full moves. It starts at 1 and is incremented after Black’s move.
Implementations§
source§impl Fen
impl Fen
sourcepub fn from_string(fen_string: &str) -> Self
pub fn from_string(fen_string: &str) -> Self
Creates a new Fen from the given string.
sourcepub fn piece_placement(&self) -> &[[Option<(PieceColor, PieceType)>; 8]; 8]
pub fn piece_placement(&self) -> &[[Option<(PieceColor, PieceType)>; 8]; 8]
Returns the piece placement.
sourcepub fn active_color(&self) -> &PieceColor
pub fn active_color(&self) -> &PieceColor
Returns the active color.
sourcepub fn castling_rights(&self) -> &CastlingRights
pub fn castling_rights(&self) -> &CastlingRights
Returns the castling rights.
sourcepub fn ep_target_square(&self) -> &Option<BoardPosition>
pub fn ep_target_square(&self) -> &Option<BoardPosition>
Returns the en passant target square.
sourcepub fn halfmove_clock(&self) -> &i32
pub fn halfmove_clock(&self) -> &i32
Returns the number of halfmoves since the last capture or pawn advance.
sourcepub fn fullmove_number(&self) -> &i32
pub fn fullmove_number(&self) -> &i32
Returns the number of the full moves.
sourcefn char_to_rank(char: char) -> usize
fn char_to_rank(char: char) -> usize
Converts the given rank char to the corresponding board index.
sourcefn char_to_file(char: char) -> usize
fn char_to_file(char: char) -> usize
Converts the given file char to the corresponding board index.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Fen
impl Send for Fen
impl Sync for Fen
impl Unpin for Fen
impl UnwindSafe for Fen
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self using data from the given [World]