Created
February 8, 2017 20:42
-
-
Save Leopard2A5/6c92ca3abb4ed643669d6fc7bd16196b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use schema::games; | |
| #[derive(Debug, Copy, Clone, PartialEq)] | |
| enum Player { | |
| P1, | |
| P2, | |
| } | |
| #[derive(Queryable)] | |
| struct Game { | |
| pub id: i32, | |
| pub current_player: Player, | |
| } | |
| #[derive(Insertable)] | |
| #[table_name="games"] | |
| struct NewGame { | |
| pub current_player: Player, | |
| } | |
| impl NewGame { | |
| fn new() -> NewGame { | |
| NewGame { | |
| current_player: Player::P1, | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment