pub async fn play_card(
server_state: ServerState,
user_id: UserId,
game_id: GameId,
card: Card,
) -> Result<(), ServerError>Expand description
Plays a card for the user in the pegging phase of a game.
This function updates the game state by playing the specified card from the user’s hand. It validates that the action is allowed for the given user and that the play is legal according to game rules.
§Parameters
server_state: The shared server state containing the game and database.user_id: The ID of the user playing the card.game_id: The ID of the game in which the card is being played.card: The card to play.
§Returns
Returns Ok(()) if the card was successfully played.
Returns a ServerError if the action is forbidden, the game is not found,
the play is illegal, or another internal error occurs.