Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
43404420
Commit
43404420
authored
7 years ago
by
Éloïs
Browse files
Options
Downloads
Plain Diff
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
!45
Resolve "documents: impl Default for Blockstamp"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
documents/Cargo.toml
+1
-1
1 addition, 1 deletion
documents/Cargo.toml
documents/lib.rs
+16
-0
16 additions, 0 deletions
documents/lib.rs
with
17 additions
and
1 deletion
documents/Cargo.toml
+
1
−
1
View file @
43404420
[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"
...
...
This diff is collapsed.
Click to expand it.
documents/lib.rs
+
16
−
0
View file @
43404420
...
@@ -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
>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment