pub struct Fen(pub Setup);
Expand description
A FEN like rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
.
Tuple Fields§
§0: Setup
Implementations§
source§impl Fen
impl Fen
sourcepub fn from_ascii(fen: &[u8]) -> Result<Fen, ParseFenError>
pub fn from_ascii(fen: &[u8]) -> Result<Fen, ParseFenError>
Parses a FEN or EPD.
FENs consist of parts separated by spaces. This parser also accepts parts separated by underscores. Missing parts are filled with defaults.
§Errors
Returns ParseFenError
if any part is syntactically invalid.
§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 const fn from_setup(setup: Setup) -> Fen
pub fn from_position<P: Position>(pos: P, mode: EnPassantMode) -> Fen
pub const fn as_setup(&self) -> &Setup
pub const fn into_setup(self) -> Setup
sourcepub fn into_position<P: FromSetup>(
self,
mode: CastlingMode
) -> Result<P, PositionError<P>>
pub fn into_position<P: FromSetup>( self, mode: CastlingMode ) -> Result<P, PositionError<P>>
Set up a Position
. See FromSetup
.
§Errors
Returns PositionError
if the setup does not meet basic validity
requirements.
Trait Implementations§
impl Eq for Fen
impl StructuralPartialEq for Fen
Auto Trait Implementations§
impl Freeze for Fen
impl RefUnwindSafe for Fen
impl Send for Fen
impl Sync for Fen
impl Unpin for Fen
impl UnwindSafe for Fen
Blanket Implementations§
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