24 lines
460 B
Rust
24 lines
460 B
Rust
|
use serde::{Deserialize, Serialize};
|
||
|
use crate::GeoffreyDatabaseModel;
|
||
|
use std::collections::HashSet;
|
||
|
|
||
|
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||
|
pub struct Town {
|
||
|
id: Option<u64>,
|
||
|
pub residents: HashSet<u64>
|
||
|
}
|
||
|
|
||
|
impl GeoffreyDatabaseModel for Town {
|
||
|
fn id(&self) -> Option<u64> {
|
||
|
self.id
|
||
|
}
|
||
|
|
||
|
fn set_id(&mut self, id: u64) {
|
||
|
self.id = Some(id)
|
||
|
}
|
||
|
|
||
|
fn tree() -> String {
|
||
|
"town".to_string()
|
||
|
}
|
||
|
}
|