pub fn check_cards(game_state: &GameState) -> Result<(), String> {
    let card_count = count_cards(game_state);

    for (index, &count) in card_count.iter().enumerate() {
        if count != 1 {
            return Err(format!(
                "Card {} exists {} times, should exist once",
                card_from_index(index), count
            ));
        }
    }

    Ok(())
}
/// Checks whether each possible card exists exactly once
Checks whether each possible card exists exactly once
Checks whether each possible card exists exactly once
pub fn check_cards(game_state: &GameState) -> Result<(), String> {
    let card_count = count_cards(game_state);
    for (index, &count) in card_count.iter().enumerate() {
        if count != 1 {
            return Err(format!(
                "Card {} exists {} times, should exist once",
                card_from_index(index), count
            ));
        }
    }
    Ok(())
}
pub fn check_cards ( game_state : & GameState ) -> Result < ( ) , String > { let card_count = count_cards ( game_state ) ; for ( index , & count ) in card_count . iter ( ) . enumerate ( ) { if count != 1 { return Err ( format ! ( " " card_from_index ( index ) count ) ) ; } } Ok ( ( ) ) }
Checks whether each possible card exists exactly once
Checks whether each possible card exists exactly once
game_state
&GameState
game_state
&GameState