byte-repr 0.1.0

A utility to inspect binary, little-endian, and big-endian memory representations of numbers.
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented2 out of 4 items with examples
  • Size
  • Source code size: 26.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 246.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • rust-dev-pan/byte-repr
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • himangshu-blockchain

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:

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.