Adding the concept of NetworkEndian.

NetworkEndian describes the byte order to use for network communication.
Generally, this is always BigEndian.
This commit is contained in:
Jason Travis Smith
2016-06-17 04:34:36 -04:00
parent 26080427c0
commit e4d821333c
3 changed files with 34 additions and 3 deletions

View File

@ -22,6 +22,13 @@ pub type PlatformEndian = BigEndian;
#[cfg(not(target_endian="big"))]
pub type PlatformEndian = LittleEndian;
/// Referes to NetworkEndian. This could be either
/// of the available endians as long as it is consistent
/// across the network. However, RFC1700 decided network
/// byte order would be BigEndian. As such, it is now the
/// common endian style for networking.
pub type NetworkEndian = BigEndian;
/// Handles serialization where the most
/// significant byte is stored at the lowest address.
pub enum BigEndian
@ -48,7 +55,14 @@ pub enum Endianess
/// Referes to PlatformEndian. This can be anyone
/// of the other available endians depending on
/// the platform you are on.
Platform
Platform,
/// Referes to NetworkEndian. This could be either
/// of the available endians as long as it is consistent
/// across the network. However, RFC1700 decided network
/// byte order would be BigEndian. As such, it is now the
/// common endian style for networking.
Network
}