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
GitLab 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
1c3a8694
Commit
1c3a8694
authored
5 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[ref] common-doc: remove unused code
parent
5bb5314e
No related branches found
No related tags found
1 merge request
!248
Elois/tests
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/dubp/common-doc/src/currencies_codes.rs
+0
-73
0 additions, 73 deletions
lib/dubp/common-doc/src/currencies_codes.rs
lib/dubp/common-doc/src/lib.rs
+0
-1
0 additions, 1 deletion
lib/dubp/common-doc/src/lib.rs
with
0 additions
and
74 deletions
lib/dubp/common-doc/src/currencies_codes.rs
deleted
100644 → 0
+
0
−
73
View file @
5bb5314e
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Implements the Duniter Documents Protocol.
use
crate
::
CurrencyName
;
use
serde
::{
Deserialize
,
Serialize
};
use
std
::
convert
::{
TryFrom
,
TryInto
};
/// CURRENCY_NULL
const
CURRENCY_NULL
:
u16
=
0x_0000
;
/// CURRENCY_G1
const
CURRENCY_G1
:
u16
=
0x_0001
;
/// CURRENCY_G1_TEST
const
CURRENCY_G1_TEST
:
u16
=
0x_1000
;
/// CurrencyCodeError
#[derive(Debug)]
pub
enum
CurrencyCodeError
{
/// UnknowCurrencyCode
UnknowCurrencyCode
,
/// IoError
IoError
(
std
::
io
::
Error
),
/// UnknowCurrencyName
UnknowCurrencyName
,
}
impl
From
<
std
::
io
::
Error
>
for
CurrencyCodeError
{
fn
from
(
error
:
std
::
io
::
Error
)
->
Self
{
CurrencyCodeError
::
IoError
(
error
)
}
}
#[derive(Debug,
Copy,
Clone,
Eq,
PartialEq,
Deserialize,
Serialize,
Hash)]
/// Currency code
pub
struct
CurrencyCode
(
u16
);
impl
TryFrom
<
CurrencyName
>
for
CurrencyCode
{
type
Error
=
CurrencyCodeError
;
fn
try_from
(
currency_name
:
CurrencyName
)
->
Result
<
Self
,
Self
::
Error
>
{
match
currency_name
.0
.as_str
()
{
"g1"
=>
Ok
(
CurrencyCode
(
CURRENCY_G1
)),
"g1-test"
=>
Ok
(
CurrencyCode
(
CURRENCY_G1_TEST
)),
_
=>
Err
(
CurrencyCodeError
::
UnknowCurrencyName
),
}
}
}
impl
TryInto
<
CurrencyName
>
for
CurrencyCode
{
type
Error
=
CurrencyCodeError
;
fn
try_into
(
self
)
->
Result
<
CurrencyName
,
Self
::
Error
>
{
match
self
.0
{
CURRENCY_NULL
=>
Ok
(
CurrencyName
(
""
.to_owned
())),
CURRENCY_G1
=>
Ok
(
CurrencyName
(
"g1"
.to_owned
())),
CURRENCY_G1_TEST
=>
Ok
(
CurrencyName
(
"g1-test"
.to_owned
())),
_
=>
Err
(
CurrencyCodeError
::
UnknowCurrencyCode
),
}
}
}
This diff is collapsed.
Click to expand it.
lib/dubp/common-doc/src/lib.rs
+
0
−
1
View file @
1c3a8694
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
extern
crate
pest_derive
;
extern
crate
pest_derive
;
pub
mod
blockstamp
;
pub
mod
blockstamp
;
pub
mod
currencies_codes
;
pub
mod
errors
;
pub
mod
errors
;
pub
mod
parser
;
pub
mod
parser
;
pub
mod
traits
;
pub
mod
traits
;
...
...
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