pub enum Outcome {
Win {
side: Color,
reason: WinReason,
},
Draw(DrawReason),
}Expand description
Outcome of the finished game
Variants§
Implementations§
Source§impl Outcome
impl Outcome
Sourcepub fn winner(&self) -> Option<Color>
pub fn winner(&self) -> Option<Color>
Extracts the winner from the outcome
If this is a draw outcome, then None is returned
Sourcepub fn is_force(&self) -> bool
pub fn is_force(&self) -> bool
Returns true if the outcome occured because one of the sides didn’t have a legal move
Similar to Outcome::passes(OutcomeFilter::Force)
Sourcepub fn passes(&self, filter: OutcomeFilter) -> bool
pub fn passes(&self, filter: OutcomeFilter) -> bool
Returns true if the outcome passes filter filter
See OutcomeFilter docs for the details about each filter
Trait Implementations§
Source§impl From<&Outcome> for GameStatus
impl From<&Outcome> for GameStatus
Source§fn from(src: &Outcome) -> GameStatus
fn from(src: &Outcome) -> GameStatus
Converts to this type from the input type.
Source§impl From<Outcome> for GameStatus
impl From<Outcome> for GameStatus
Source§fn from(src: Outcome) -> GameStatus
fn from(src: Outcome) -> GameStatus
Converts to this type from the input type.
impl Copy for Outcome
impl Eq for Outcome
impl StructuralPartialEq for Outcome
Auto Trait Implementations§
impl Freeze for Outcome
impl RefUnwindSafe for Outcome
impl Send for Outcome
impl Sync for Outcome
impl Unpin for Outcome
impl UnwindSafe for Outcome
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