From 733d090b9bb68df19fe7db38ddb53b112dba48ab Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Sun, 15 Sep 2019 12:11:07 -0700 Subject: [PATCH] Add missing derives to newtypes. --- zebra-chain/src/types.rs | 4 ++++ zebra-network/src/message.rs | 2 ++ zebra-network/src/meta_addr.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/zebra-chain/src/types.rs b/zebra-chain/src/types.rs index 9a33fe7b8..de17d1e63 100644 --- a/zebra-chain/src/types.rs +++ b/zebra-chain/src/types.rs @@ -16,11 +16,14 @@ impl<'a> From<&'a [u8]> for Sha256dChecksum { } /// A u32 which represents a block height value. +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct BlockHeight(pub u32); /// InventoryType /// /// [Bitcoin·reference](https://en.bitcoin.it/wiki/Protocol_documentation#Inventory_Vectors) +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[repr(u8)] pub enum InventoryType { /// Any data of with this number may be ignored. Error = 0x00, @@ -48,6 +51,7 @@ pub enum InventoryType { } /// Inventory Vector +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct InventoryVector(pub InventoryType, pub [u8; 32]); #[cfg(test)] diff --git a/zebra-network/src/message.rs b/zebra-network/src/message.rs index 55b957ca8..a5f55e2a1 100644 --- a/zebra-network/src/message.rs +++ b/zebra-network/src/message.rs @@ -37,6 +37,7 @@ use crate::types::*; // the serialized message data and the internal representation. Note that this // is different from messages like GetAddr which have no data (and so have no // fields). +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Message { /// A `version` message. /// @@ -245,6 +246,7 @@ pub enum Message { /// Reject Reason CCodes /// /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#reject) +#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(u8)] #[allow(missing_docs)] pub enum RejectReason { diff --git a/zebra-network/src/meta_addr.rs b/zebra-network/src/meta_addr.rs index f5aecd016..6005eac3a 100644 --- a/zebra-network/src/meta_addr.rs +++ b/zebra-network/src/meta_addr.rs @@ -8,6 +8,7 @@ use crate::types::Services; /// An address with metadata on its advertised services and last-seen time. /// /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#Network_address) +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct MetaAddr { /// The peer's address. pub addr: SocketAddr,