DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

a77b7b64bbd16649318cfaa0716335fb588eca71 — Jonni Liljamo 1 year, 10 months ago f1ee8a9
feat(sdbclient): GameState enum
3 files changed, 24 insertions(+), 1 deletions(-)

M Cargo.lock
M sdbclient/Cargo.toml
M sdbclient/src/api/game/types.rs
M Cargo.lock => Cargo.lock +12 -0
@@ 3662,6 3662,7 @@ dependencies = [
 "reqwest",
 "serde",
 "serde_json",
 "serde_repr",
 "toml 0.7.1",
]



@@ 3735,6 3736,17 @@ dependencies = [
]

[[package]]
name = "serde_repr"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

M sdbclient/Cargo.toml => sdbclient/Cargo.toml +1 -0
@@ 42,6 42,7 @@ reqwest = { version = "0.11.14", features = ["blocking", "json"] }
# (de)serialization
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.91"
serde_repr = "0.1.10"

# futures for async
futures-lite = "1.12.0"

M sdbclient/src/api/game/types.rs => sdbclient/src/api/game/types.rs +11 -1
@@ 7,9 7,19 @@
 */

use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};

use crate::api::user::types::UserPub;

#[derive(Debug, Serialize_repr, Deserialize_repr, Clone, PartialEq)]
#[repr(u8)]
pub enum GameState {
    Forming = 0,
    InProgress = 1,
    Finished = 2,
    Cancelled = 3,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Game {
    pub id: String,


@@ 19,6 29,6 @@ pub struct Game {
    pub host: UserPub,
    pub guest_id: String,
    pub guest: UserPub,
    pub state: u8,
    pub state: GameState,
    pub ended_at: String,
}