Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 75d0e37

Browse files
committed
[ethcore-types]: DataFormat add docs + tabify
1 parent 387d0dc commit 75d0e37

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

ethcore/types/src/data_format.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,26 @@ use std::str::FromStr;
2020
/// Format for importing/exporting blocks
2121
#[derive(Debug, PartialEq)]
2222
pub enum DataFormat {
23-
Hex,
24-
Binary,
23+
/// Hexadecimal format
24+
Hex,
25+
/// Binary format
26+
Binary,
2527
}
2628

2729
impl Default for DataFormat {
28-
fn default() -> Self {
29-
DataFormat::Binary
30-
}
30+
fn default() -> Self {
31+
DataFormat::Binary
32+
}
3133
}
3234

3335
impl FromStr for DataFormat {
34-
type Err = String;
35-
36-
fn from_str(s: &str) -> Result<Self, Self::Err> {
37-
match s {
38-
"binary" | "bin" => Ok(DataFormat::Binary),
39-
"hex" => Ok(DataFormat::Hex),
40-
x => Err(format!("Invalid format: {}", x))
41-
}
42-
}
36+
type Err = String;
37+
38+
fn from_str(s: &str) -> Result<Self, Self::Err> {
39+
match s {
40+
"binary" | "bin" => Ok(DataFormat::Binary),
41+
"hex" => Ok(DataFormat::Hex),
42+
x => Err(format!("Invalid format: {}", x))
43+
}
44+
}
4345
}

0 commit comments

Comments
 (0)