byte-repr
byte-repr
is a lightweight Rust crate for inspecting the memory representation of numeric values. It helps visualize the binary, little-endian, and big-endian byte representations, including their hex format with zero padding.
Useful for:
- Learning and teaching byte order (endianness)
- Debugging binary data
- Understanding how integers are stored in memory
✨ Features
- Print values in:
- Binary format
- Little-endian byte array
- Big-endian byte array
- Hexadecimal representation with zero padding
- Color-coded output for clarity
- Macro-based extensibility for numeric types
🚀 Usage
Add this to your Cargo.toml
:
[]
= "0.1.0" # update after publishing
Then use in your code:
use represent;
Example Output:
🔧 Supported Types
Currently supports:
i8
u16
u32
More can be added using the impl_byterep!
macro.
📦 License
Licensed under MIT OR Apache-2.0.