From 6feb700c8000e79d4caa89c52d57349ed9a43ea5 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 11 Sep 2019 09:18:13 +0200 Subject: [PATCH] [ethcore-types]: `DataFormat` add docs + tabify --- ethcore/types/src/data_format.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ethcore/types/src/data_format.rs b/ethcore/types/src/data_format.rs index 8cfe5cf2be3..418ecee0ead 100644 --- a/ethcore/types/src/data_format.rs +++ b/ethcore/types/src/data_format.rs @@ -20,24 +20,26 @@ use std::str::FromStr; /// Format for importing/exporting blocks #[derive(Debug, PartialEq)] pub enum DataFormat { - Hex, - Binary, + /// Hexadeicmal format + Hex, + /// Binary format + Binary, } impl Default for DataFormat { - fn default() -> Self { - DataFormat::Binary - } + fn default() -> Self { + DataFormat::Binary + } } impl FromStr for DataFormat { - type Err = String; - - fn from_str(s: &str) -> Result { - match s { - "binary" | "bin" => Ok(DataFormat::Binary), - "hex" => Ok(DataFormat::Hex), - x => Err(format!("Invalid format: {}", x)) - } - } + type Err = String; + + fn from_str(s: &str) -> Result { + match s { + "binary" | "bin" => Ok(DataFormat::Binary), + "hex" => Ok(DataFormat::Hex), + x => Err(format!("Invalid format: {}", x)) + } + } }