pub enum GameCommand {
HostGame {
user_id: UserId,
game_id: GameId,
},
JoinGame {
user_id: UserId,
},
PlayComputer {
user_id: UserId,
game_id: GameId,
},
CutForDeal {
player: Player,
},
StartGame {
player: Player,
},
DiscardCards {
player: Player,
cards: Vec<Card>,
},
PlayCard {
player: Player,
card: Card,
},
Go {
player: Player,
},
ScorePone {
player: Player,
},
ScoreDealer {
player: Player,
},
ScoreCrib {
player: Player,
},
StartNextRound {
player: Player,
},
}Expand description
Commands that drive the game state machine.
Each variant represents an action a player can take.
Variants§
HostGame
User wants to create a new game and become its host. The game will require a guest to join in order to continue.
JoinGame
User wants to join the game has a guest.
PlayComputer
Client wants to start a single-player game against the computer.
CutForDeal
Player cuts the deck to determine who deals first.
StartGame
Player signals they are ready for the game to start.
This is a Pending acknowledgment on the CutForDeal cuts.
DiscardCards
Player discards two cards to the crib.
Fields
PlayCard
Player plays a card during the Playing (or Pegging) phase.
Fields
Go
Player declares go during the Playing (or Pegging) phase.
ScorePone
Player requests scoring of the non-dealer’s hand.
This is a Pending acknowledgment at the end of the Playing phase.
ScoreDealer
Player requests scoring of the dealer’s hand.
This is a Pending acknowledgment at the end of the ScoringPone phase.
ScoreCrib
Player requests scoring of the dealer’s crib.
This is a Pending acknowledgment at the end of the ScoringDealer phase.
StartNextRound
Player requests that the next Discarding round should start.
This is a Pending acknowledgment at the end of the ScoringCrib phase.
Trait Implementations§
Source§impl AsRef<str> for GameCommand
impl AsRef<str> for GameCommand
Source§impl Debug for GameCommand
impl Debug for GameCommand
Source§impl<'de> Deserialize<'de> for GameCommand
impl<'de> Deserialize<'de> for GameCommand
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>,
Auto Trait Implementations§
impl Freeze for GameCommand
impl RefUnwindSafe for GameCommand
impl Send for GameCommand
impl Sync for GameCommand
impl Unpin for GameCommand
impl UnwindSafe for GameCommand
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more