Trait VariantBuilder
Source pub trait VariantBuilder: Sized + Default {
// Required methods
fn name() -> &'static str;
fn new(game: Game) -> Self;
fn from_fen(fen: &str) -> Result<Self, FenError>;
fn from_pgn(pgn: &str) -> Result<Self, PGNError>;
fn load(path: &str) -> Result<Self, PGNError>;
fn load_all(path: &str) -> Result<Vec<Self>, PGNError>;
}
Expand description
Construction helpers for variant types.
The name of the variant.
§Returns
The name of the variant.
Creates a new instance of the variant.
§Returns
A new instance of the variant.
Creates a new instance of the variant from a FEN string.
§Arguments
§Returns
A Result<Self, FenError> object
Ok(Self) - A new instance of the variant.
Err(FenError) - An error occurred while parsing the FEN string.
Creates a new instance of the variant from a PGN string.
§Arguments
§Returns
A Result<Self, PgnError> object
Ok(Self) - A new instance of the variant.
Err(PgnError) - An error occurred while parsing the PGN string.
Loads the game from a file.
§Arguments
path - The path to the file.
§Returns
A Result<Self, PgnError> object
Ok(Self) - The game was loaded successfully.
Err(PgnError) - An error occurred while loading the game.
Loads multiple games from a file.
§Arguments
path - The path to the file.
§Returns
A Result<Vec<Self>, PgnError> object
Ok(Vec<Self>) - The games were loaded successfully.
Err(PgnError) - An error occurred while loading the games.
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.