feat: add state version to State
This commit is contained in:
@@ -34,6 +34,7 @@ tracing-subscriber-wasm = "0.1.0"
|
||||
ron = { version = "0.8" }
|
||||
rand = { version = "0.8", optional = true }
|
||||
web-sys = { version = "0.3.76", features = ["File", "FileList"] }
|
||||
smart-default = "0.7.1"
|
||||
|
||||
[dev-dependencies.serde_json]
|
||||
version = "1"
|
||||
|
||||
@@ -43,11 +43,14 @@ pub mod cli {
|
||||
pub mod state {
|
||||
//! Server state
|
||||
|
||||
const STATE_VERSION: u64 = 1;
|
||||
|
||||
use super::persistence::Persistent;
|
||||
use crate::models;
|
||||
use crate::models::Wall;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use smart_default::SmartDefault;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -55,8 +58,12 @@ pub mod state {
|
||||
pub persistent: Persistent<PersistentState>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, SmartDefault)]
|
||||
pub struct PersistentState {
|
||||
/// State schema version
|
||||
#[default(STATE_VERSION)]
|
||||
pub version: u64,
|
||||
|
||||
pub wall: Wall,
|
||||
pub problems: Problems,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user