endian-type
Type safe wrappers for types with a defined byte order.
Example
use ;
// The endianness reflects the type-safety of the declaration:
let foo = 0xbeef_u32;
let foo_be = from;
assert_eq!;
assert_eq!;
// One can convert back to the native representation using the `From`/`Into` traits:
assert_eq!;
// To operate on the wrapped types as if they are regular numbers, one has to
// be explicit and switch between the byte representations:
// Note: Internally, these are just [transmutations](https://doc.rust-lang.org/core/mem/fn.transmute.html) and should not affect performance.
let foo = u128MAX;
let foo_le = from;
assert_eq!;
// We also have a couple of aliases to be used as helper.
//
// This will assert our `NetworkOrder` type is in accordance with the IETF RFC1700.
let foo = -0xdead_i32;
let foo_no = from;
let foo_be = from;
assert_eq!;
assert_eq!;