midgard_rs/types/height_hash.rs
1use serde::{Deserialize, Serialize};
2
3/*
4*** HeightHash Scheme ***
5{
6 "height": 0,
7 "hash": "string"
8}
9*/
10
11#[derive(Serialize, Deserialize, Debug, Clone)]
12pub struct HeightHash {
13 height: u64,
14 hash: String,
15}
16
17impl HeightHash {
18 #[must_use]
19 pub const fn new(height: u64, hash: String) -> Self {
20 Self { height, hash }
21 }
22
23 #[must_use]
24 pub const fn get_height(&self) -> u64 {
25 self.height
26 }
27
28 #[must_use]
29 pub fn get_hash(&self) -> &str {
30 &self.hash
31 }
32}