Enum backgammon::rules::Player
source · pub enum Player {
Nobody,
Player0,
Player1,
}
Expand description
Represents a player in the game.
Part of the rules of the game is that this game is for only two players, we call them Player 0 and Player 1. The labels are chosen arbitrarily and do not affect the game at all, however, it is convenient here to use 0 and 1 as labels because we sometimes use Rust tuples which we can then address the same way. There is a special case where nobody is allowed to move or act, for example when a game begins or ends, thus we define this as the default.
Variants§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Player
impl<'de> Deserialize<'de> for Player
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Player
impl Ord for Player
source§impl PartialEq<Player> for Player
impl PartialEq<Player> for Player
source§impl PartialOrd<Player> for Player
impl PartialOrd<Player> for Player
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Player
impl Eq for Player
impl StructuralEq for Player
impl StructuralPartialEq for Player
Auto Trait Implementations§
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnwindSafe for Player
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