feat: Basic structs
- Added Account struct - Added Config struct - Added empty Map struct - Added Quest struct
This commit is contained in:
parent
753d0e18e2
commit
4e3c137f8b
8 changed files with 441 additions and 0 deletions
24
src/account/mod.rs
Normal file
24
src/account/mod.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
//! Module for handling user accounts
|
||||
|
||||
use serde::{ Serialize, Deserialize };
|
||||
|
||||
fn default_id() -> String {
|
||||
"none".to_string()
|
||||
}
|
||||
|
||||
/// User account struct, which can be (de-)serialized from/into TOML
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Account {
|
||||
|
||||
/// User id, specific to used service
|
||||
#[serde(default = "default_id")]
|
||||
pub id: String,
|
||||
|
||||
/// User balance,
|
||||
#[serde(default)]
|
||||
pub balance: u32,
|
||||
|
||||
/// Id of room node where user is located
|
||||
#[serde(default)]
|
||||
pub location: u16
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue