Add derived impls to newtypes

This commit is contained in:
Henry de Valence 2019-09-14 08:15:22 -07:00 committed by Deirdre Connolly
parent c3b7dcdfbe
commit 73cd06b4dc
1 changed files with 4 additions and 0 deletions

View File

@ -1,15 +1,19 @@
//! Newtype wrappers assigning semantic meaning to primitive types.
/// A magic number identifying the network.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Magic(pub u32);
/// A protocol version number.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Version(pub u32);
/// Bitfield of features to be enabled for this connection.
// Tower provides utilities for service discovery, so this might go
// away in the future in favor of that.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Services(pub u64);
/// A nonce used in the networking layer to identify messages.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Nonce(pub u64);