Trait network_endian::NetworkEndian [−][src]
pub trait NetworkEndian: Sized + Default + Debug + Copy + Clone + PartialOrd + Ord + PartialEq + Eq + Hash + Display + Serialize + DeserializeOwned { type Bytes; const Length: usize; fn to_bytes(self) -> Self::Bytes; fn bytes(&self) -> &[u8]; fn write_to_hash<H: Hasher>(&self, hasher: &mut H); }
Abstract network endian data.
Associated Types
type Bytes
Implements [u8; Self::Length]
but this can not yet be expressed in Rust.
Associated Constants
Required Methods
fn to_bytes(self) -> Self::Bytes
Convert into bytes.
fn bytes(&self) -> &[u8]
Underlying bytes.
fn write_to_hash<H: Hasher>(&self, hasher: &mut H)
Writes to a hasher creating a hash.
Implementors
impl NetworkEndian for NetworkEndianU16 type Bytes = [u8; 2];
impl NetworkEndian for NetworkEndianU32 type Bytes = [u8; 4];
impl NetworkEndian for NetworkEndianU128 type Bytes = [u8; 16];