pub enum GameEvent {
Show 16 variants
LobbyGameCreated {
game_id: GameId,
host: UserId,
name: String,
},
LobbyGameJoined {
guest: UserId,
},
ComputerGameCreated {
game_id: GameId,
host: UserId,
guest: UserId,
name: String,
},
CutForDealMade {
player: Player,
cut: Card,
},
GameStarted {
player: Player,
},
CutForDealTied,
CutForDealDecided {
dealer: Dealer,
},
HandDealt {
player: Player,
hand: Hand,
},
CardsDiscarded {
player: Player,
cards: Vec<Card>,
},
StarterSelected {
cut: StarterCut,
pegging: Pegging,
},
CardPlayed {
player: Player,
card: Card,
pegging: Pegging,
},
GoCalled {
player: Player,
pegging: Pegging,
},
PoneScored {
player: Player,
pegging: Pegging,
},
DealerScored {
player: Player,
pegging: Pegging,
},
CribScored {
player: Player,
pegging: Pegging,
},
NextRoundStarted {
player: Player,
},
}Expand description
Domain events which represent the single source of truth for game history and are persisted in the event store. The current game state is derived by folding them in order.
Variants§
LobbyGameCreated
A user created a lobby game and is waiting for another user to join
Fields
LobbyGameJoined
A user joined a game that was previously a lobby game.
ComputerGameCreated
A user a computer game.
Fields
CutForDealMade
A player cut a card for the choice of initial dealer.
Fields
GameStarted
A player has acknowledged the cut for deal. When both players have acknowledge the cards will be dealt and discarding begin.
CutForDealTied
Both plays have cut for deal (and acknowledged the cut); the cuts were the same rank, so the cut needs to be redrawn.
CutForDealDecided
Both plays have cut for deal (and acknowledged the cut); the cuts were different, so the dealer is selected and the deal can progress.
HandDealt
A hand has been dealt to the player, following CutForDealDecided
or NextRoundStarted.
Fields
CardsDiscarded
A player has discarded cards to the crib.
Fields
StarterSelected
Both players have discarded cards to the crib and the “Starter” card selected.
CardPlayed
A player has played a card during the Playing (or Pegging) phase.
Fields
GoCalled
A player has called Go during the Playing (or Pegging) phase.
Fields
PoneScored
A player has acknowledged End of Plays; when both players
have acknowledged then the Pone’s hand will be scored.
Fields
DealerScored
A player has acknowledged the Pone Score; when both players
have acknowledged then the Dealer’s hand will be scored.
Fields
CribScored
A player has acknowledged the Dealer Score; when both players
have acknowledged then the Dealer’s crib will be scored.
Fields
NextRoundStarted
A player has acknowledged the Crib Score; when both players
have acknowledged then the next round will start, swapping dealers.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GameEvent
impl<'de> Deserialize<'de> for GameEvent
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>,
Source§impl DomainEvent for GameEvent
impl DomainEvent for GameEvent
Source§fn event_type(&self) -> String
fn event_type(&self) -> String
Source§fn event_version(&self) -> String
fn event_version(&self) -> String
event_type, used for event upcasting.impl Eq for GameEvent
impl StructuralPartialEq for GameEvent
Auto Trait Implementations§
impl Freeze for GameEvent
impl RefUnwindSafe for GameEvent
impl Send for GameEvent
impl Sync for GameEvent
impl Unpin for GameEvent
impl UnwindSafe for GameEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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