cargo fmt

This commit is contained in:
James Wilson
2021-07-13 16:51:24 +01:00
parent 9ac5ea7624
commit c1208b9e81
13 changed files with 466 additions and 306 deletions
+13 -13
View File
@@ -22,7 +22,6 @@ pub struct NodeDetails {
pub startup_time: Option<Box<str>>,
}
///
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct NodeStats {
@@ -42,7 +41,7 @@ impl Serialize for NodeStats {
}
}
impl <'de> Deserialize<'de> for NodeStats {
impl<'de> Deserialize<'de> for NodeStats {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -52,7 +51,6 @@ impl <'de> Deserialize<'de> for NodeStats {
}
}
///
#[derive(Default)]
pub struct NodeIO {
@@ -71,7 +69,6 @@ impl Serialize for NodeIO {
}
}
///
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq)]
pub struct Block {
@@ -88,7 +85,6 @@ impl Block {
}
}
///
#[derive(Default)]
pub struct NodeHardware {
@@ -114,7 +110,6 @@ impl Serialize for NodeHardware {
}
}
///
#[derive(Debug, Clone, PartialEq)]
pub struct NodeLocation {
@@ -136,17 +131,20 @@ impl Serialize for NodeLocation {
}
}
impl <'de> Deserialize<'de> for NodeLocation {
impl<'de> Deserialize<'de> for NodeLocation {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let (latitude, longitude, city) = <(f32, f32, Box<str>)>::deserialize(deserializer)?;
Ok(NodeLocation { latitude, longitude, city })
Ok(NodeLocation {
latitude,
longitude,
city,
})
}
}
///
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct BlockDetails {
@@ -182,18 +180,20 @@ impl Serialize for BlockDetails {
}
}
impl <'de> Deserialize<'de> for BlockDetails {
impl<'de> Deserialize<'de> for BlockDetails {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let tup = <(u64, BlockHash, u64, u64, Option<u64>)>::deserialize(deserializer)?;
Ok(BlockDetails {
block: Block { height: tup.0, hash: tup.1 },
block: Block {
height: tup.0,
hash: tup.1,
},
block_time: tup.2,
block_timestamp: tup.3,
propagation_time: tup.4
propagation_time: tup.4,
})
}
}