nxtnote_savefile_format/
models.rs1use super::schema::{block_properties, blocks};
2use std::hash::{Hash, Hasher};
3
4#[derive(Queryable, Insertable, Identifiable)]
5#[primary_key(block_id, name)]
6#[table_name = "block_properties"]
7pub struct BlockProperty {
8 pub block_id: Vec<u8>,
9 pub name: String,
10 pub data: Vec<u8>,
11}
12
13#[derive(Queryable, Insertable)]
14#[table_name = "blocks"]
15pub struct Block {
16 pub id: Vec<u8>,
17 pub rank: String,
18 pub type_: String,
19}
20
21impl PartialEq for Block {
22 fn eq(&self, other: &Self) -> bool {
23 self.id == other.id
24 }
25}
26
27impl Eq for Block {}
28
29impl Hash for Block {
30 fn hash<H: Hasher>(&self, state: &mut H) {
31 state.write(&self.id);
32 }
33}