Trait shakmaty::FromSetup

source ·
pub trait FromSetup: Sized {
    // Required method
    fn from_setup(
        setup: Setup,
        mode: CastlingMode
    ) -> Result<Self, PositionError<Self>>;
}
Expand description

Validate and set up a playable Position. All provided chess variants support this.

Required Methods§

source

fn from_setup( setup: Setup, mode: CastlingMode ) -> Result<Self, PositionError<Self>>

Set up a playable Position.

§Errors

Returns PositionError if the Setup does not meet basic validity requirements.

Meeting the requirements does not imply that the position is actually reachable with a series of legal moves from the starting position.

§Examples
use shakmaty::{CastlingMode, Chess, FromSetup, Setup, PositionError};

let setup = Setup::default();

let pos = Chess::from_setup(setup, CastlingMode::Standard)
    .or_else(PositionError::ignore_too_much_material)
    .or_else(PositionError::ignore_impossible_check)?;

Object Safety§

This trait is not object safe.

Implementors§

source§

impl FromSetup for Antichess

Available on crate feature variant only.
source§

impl FromSetup for Atomic

Available on crate feature variant only.
source§

impl FromSetup for Chess

source§

impl FromSetup for Crazyhouse

Available on crate feature variant only.
source§

impl FromSetup for Horde

Available on crate feature variant only.
source§

impl FromSetup for KingOfTheHill

Available on crate feature variant only.
source§

impl FromSetup for RacingKings

Available on crate feature variant only.
source§

impl FromSetup for ThreeCheck

Available on crate feature variant only.