Add missing derives to newtypes.

This commit is contained in:
Henry de Valence 2019-09-15 12:11:07 -07:00
parent 7c662dda31
commit b819ffbc54
3 changed files with 7 additions and 0 deletions

View File

@ -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)]

View File

@ -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 {

View File

@ -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,