Skip to content
Snippets Groups Projects
Commit 43404420 authored by Éloïs's avatar Éloïs
Browse files

Merge branch '53-documents-impl-default-for-blockstamp' into 'dev'

Resolve "documents: impl Default for Blockstamp"

Closes #53

See merge request !45
parents 3eca67ae 6cc348b0
No related branches found
No related tags found
1 merge request!45Resolve "documents: impl Default for Blockstamp"
[package] [package]
name = "duniter-documents" name = "duniter-documents"
version = "0.7.0" version = "0.7.1"
authors = ["nanocryk <nanocryk@duniter.org>", "elois <elois@ifee.fr>"] authors = ["nanocryk <nanocryk@duniter.org>", "elois <elois@ifee.fr>"]
description = "Handles Duniter documents" description = "Handles Duniter documents"
repository = "https://git.duniter.org/nodes/rust/duniter-rs" repository = "https://git.duniter.org/nodes/rust/duniter-rs"
......
...@@ -63,6 +63,13 @@ impl Debug for Hash { ...@@ -63,6 +63,13 @@ impl Debug for Hash {
} }
} }
impl Default for Hash {
fn default() -> Hash {
let default: [u8; 32] = [0; 32];
Hash(default)
}
}
impl Hash { impl Hash {
/// Convert a `Hash` to an hex string. /// Convert a `Hash` to an hex string.
pub fn to_hex(&self) -> String { pub fn to_hex(&self) -> String {
...@@ -168,6 +175,15 @@ impl Debug for Blockstamp { ...@@ -168,6 +175,15 @@ impl Debug for Blockstamp {
} }
} }
impl Default for Blockstamp {
fn default() -> Blockstamp {
Blockstamp {
id: BlockId(0),
hash: BlockHash(Hash::default()),
}
}
}
impl Blockstamp { impl Blockstamp {
/// Create a `BlockUId` from a text. /// Create a `BlockUId` from a text.
pub fn from_string(src: &str) -> Result<Blockstamp, BlockUIdParseError> { pub fn from_string(src: &str) -> Result<Blockstamp, BlockUIdParseError> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment