pub fn represent<T>(value: &T)
Expand description
A generic function that prints multiple memory-level representations of a numeric value, including binary, little-endian, and big-endian formats.
It supports:
- Binary view
- Little-endian byte array and hex
- Big-endian byte array and hex
§Requirements:
- The type must implement
Display
,Binary
,Copy
, andByteRepr
.
§Color Codes (Terminal):
- Binary: Red
- LE Bytes: Green
- LE Hex: Yellow
- BE Bytes: Blue
- BE Hex: Magenta
§Examples
use byte_repr::represent;
let x = 255u8;
represent(&x);
let x = 65535u16;
represent(&x);
let x = 4294967295u32;
represent(&x);
let x = 18446744073709551615u64;
represent(&x);
let x = 340282366920938463463374607431768211455u128;
represent(&x);
let x = 18446744073709551615usize;
represent(&x);