diff options
| author | Yigit Sever | 2021-04-19 03:57:46 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-19 03:57:46 +0300 |
| commit | 1688000fbc4669b30b986370d2773e0a9c55a918 (patch) | |
| tree | 402cc8da9de38099fd32560a663ade4b0454c451 | |
| parent | 9ad288e25973488a3cfc83533456d5d741e08e3b (diff) | |
| download | gradecoin-1688000fbc4669b30b986370d2773e0a9c55a918.tar.gz gradecoin-1688000fbc4669b30b986370d2773e0a9c55a918.tar.bz2 gradecoin-1688000fbc4669b30b986370d2773e0a9c55a918.zip | |
Add default for Db
| -rw-r--r-- | src/schema.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/schema.rs b/src/schema.rs index eae60af..81bfc1b 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
| @@ -34,7 +34,7 @@ fn block_parser(path: String) -> u64 { | |||
| 34 | fn last_block_content() -> Option<String> { | 34 | fn last_block_content() -> Option<String> { |
| 35 | let blocks = read_block_name().unwrap(); | 35 | let blocks = read_block_name().unwrap(); |
| 36 | 36 | ||
| 37 | if blocks.len() == 0 { | 37 | if blocks.is_empty() { |
| 38 | return None; | 38 | return None; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| @@ -173,6 +173,12 @@ impl Db { | |||
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | impl Default for Db { | ||
| 177 | fn default() -> Self { | ||
| 178 | Self::new() | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 176 | /// A transaction between `source` and `target` that moves `amount` | 182 | /// A transaction between `source` and `target` that moves `amount` |
| 177 | #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] | 183 | #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] |
| 178 | pub struct Transaction { | 184 | pub struct Transaction { |
