[][src]Struct shakmaty::fen::Fen

pub struct Fen {
    pub board: Board,
    pub pockets: Option<Material>,
    pub turn: Color,
    pub castling_rights: Bitboard,
    pub ep_square: Option<Square>,
    pub remaining_checks: Option<RemainingChecks>,
    pub halfmoves: u32,
    pub fullmoves: NonZeroU32,
}

A parsed FEN.

Fields

board: Boardpockets: Option<Material>turn: Colorcastling_rights: Bitboardep_square: Option<Square>remaining_checks: Option<RemainingChecks>halfmoves: u32fullmoves: NonZeroU32

Implementations

impl Fen[src]

pub fn empty() -> Fen[src]

The FEN of the empty position 8/8/8/8/8/8/8/8 w - - 0 1.

pub fn position<P: FromSetup>(
    &self,
    mode: CastlingMode
) -> Result<P, PositionError<P>>
[src]

Set up a Position.

Errors

Returns PositionError if the setup is not a legal position.

pub fn from_ascii(fen: &[u8]) -> Result<Fen, ParseFenError>[src]

Parses a FEN.

Errors

Returns ParseFenError if the input is not a valid FEN.

Example

use shakmaty::fen::Fen;

let fen = Fen::from_ascii(b"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")?;
assert_eq!(fen, Fen::default());

pub fn from_setup<S: Setup>(setup: &S) -> Fen[src]

Trait Implementations

impl Clone for Fen[src]

impl Debug for Fen[src]

impl Default for Fen[src]

impl Display for Fen[src]

impl Eq for Fen[src]

impl FromStr for Fen[src]

type Err = ParseFenError

The associated error which can be returned from parsing.

impl PartialEq<Fen> for Fen[src]

impl Setup for Fen[src]

impl StructuralEq for Fen[src]

impl StructuralPartialEq for Fen[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> 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> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.