pub enum GameResult {
Draw,
Decisive(PlayerColor),
}
Expand description
Represents the result of a chess game. An ongoing game is not considered a result. The game can end in a draw or with one of the players winning.
Variants§
Draw
The game ended in a draw.
Decisive(PlayerColor)
The game is over with PlayerColor
being the winner.
Implementations§
Source§impl GameResult
impl GameResult
Sourcepub fn to_string(result: Option<&Self>) -> String
pub fn to_string(result: Option<&Self>) -> String
Returns the string representation of the game result.
If the game is ongoing, it returns *
.
Sourcepub fn from_string(result: &str) -> Option<GameResult>
pub fn from_string(result: &str) -> Option<GameResult>
Converts a string representation of the game result to a GameResult
enum.
Returns None
if the string is not a valid representation of a game result.
Trait Implementations§
Source§impl Debug for GameResult
impl Debug for GameResult
Source§impl PartialEq for GameResult
impl PartialEq for GameResult
impl StructuralPartialEq for GameResult
Auto Trait Implementations§
impl Freeze for GameResult
impl RefUnwindSafe for GameResult
impl Send for GameResult
impl Sync for GameResult
impl Unpin for GameResult
impl UnwindSafe for GameResult
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