2 unstable releases
Uses old Rust 2015
0.1.0 | Jul 13, 2016 |
---|---|
0.0.1 | Jul 12, 2016 |
#5 in #nue
11KB
250 lines
byteorder-pod-rs
byteorder-pod
is a crate that provides wrappers around primitive numeric types
and stores them in memory in a specified endianness.
Documentation
See the documentation for up to date information.
lib.rs
:
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());
Dependencies
~205KB