2 unstable releases
Uses new Rust 2024
new 0.2.0 | Apr 10, 2025 |
---|---|
0.1.0 | Apr 9, 2025 |
#380 in Debugging
55 downloads per month
22KB
107 lines
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
:
[dependencies]
byte-repr = "0.1.0" # update after publishing
Then use in your code:
use byte_repr::represent;
fn main() {
let x = 42u16;
represent(&x);
}
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.