Crate byteorder_pod [] [src]

Provides types that assist with byte order conversions of primitive data types.

Example

use pod::Pod;
use byteorder_pod::unaligned::{Le, Be};

unsafe impl Pod for Data { }

#[repr(C)]
struct Data(u8, Le<u16>, Be<u32>);

let data = Data(1, From::from(0x2055), From::from(0xdeadbeef));

let cmp = &[
    0x01,
    0x55, 0x20,
    0xde, 0xad, 0xbe, 0xef,
];

assert_eq!(cmp, data.as_bytes());

Modules

aligned

Aligned type aliases

unaligned

Unaligned type aliases

Structs

EndianPrimitive

A POD container for a primitive that stores a value in the specified endianness in memory, and transforms on get/set

Traits

EndianConvert

Describes a value that can be converted to and from a specified byte order.