rend is a library that provides endian-aware primitives for Rust.


rend in action

```rust use rend::*;

let littleint = i32le::new(0x12345678); // Internal representation is little-endian asserteq!([0x78, 0x56, 0x34, 0x12], unsafe { ::core::mem::transmute::<_, [u8; 4]>(littleint) });

// Can also be made with .into() let littleint: i32le = 0x12345678.into(); // Still formats correctly asserteq!("305419896", format!("{}", littleint)); asserteq!("0x12345678", format!("0x{:x}", littleint));

let bigint = i32be::new(0x12345678); // Internal representation is big-endian asserteq!([0x12, 0x34, 0x56, 0x78], unsafe { ::core::mem::transmute::<_, [u8; 4]>(bigint) });

// Can also be made with .into() let bigint: i32be = 0x12345678.into(); // Still formats correctly asserteq!("305419896", format!("{}", bigint)); asserteq!("0x12345678", format!("0x{:x}", bigint)); ```