Formats bit-focused data structurs for printing to the console or inclusion in log files.
I created this crate to solve a specific problem. It is in a very early stage.
THERE WILL BE BUGS
The library currently recognizes the following bit-focused formats.
Used to print bytes formatted as a table of QWORDs (32-bit) (8 bytes per row).
The following is an example of the output produced by bitformat::QwordTable
+--------+--------+--------+--------+--------+--------+--------+--------+
Bytes | Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 |
+------+--------+--------+--------+--------+--------+--------+--------+--------+
|QWORD |10000001|10000011|01011010|00001110|10010001|00110110|00111011|01101100|
| 1 | (129)| (131)| (90)| (14)| (145)| (54)| (59)| (108)|
+------+--------+--------+--------+--------+--------+--------+--------+--------+
|QWORD |11110010|
| 2 | (242)|
+------+--------+
Formats WebSocket data frames as specified in RFC6455: https://tools.ietf.org/html/rfc6455#section-5.2
The following is an example of the output produced by bitformat::WebSocketFrame
+---------------+---------------+---------------+---------------+
Frame Data | Byte 0 | Byte 1 | Byte 2 | Byte 3 |
(Masked) +---------------+---------------+---------------+---------------+
(Short) |0 | 1 | 2 | 3 |
|0 1 2 3 4 5 6 7|8 9 0 1 2 3 4 5|6 7 8 9 0 1 2 3|4 5 6 7 8 9 0 1|
+-------+-+-+-+-+-------+-+-------------+-------------------------------+
| DWORD |1|0|0|0|0 0 0 1|1|0 0 0 0 0 1 1|0 1 0 1 1 0 1 0|0 0 0 0 1 1 1 0|
| 1 |F|R|R|R| |M| | |
| |I|S|S|S|op code|A| Payload len | Masking-key (part 1) |
| |N|V|V|V| (4 b) |S| (7 bits) | (16 bits) |
| | |1|2|3| |K| | |
+-------+-+-+-+-+-------+-+-------------+-------------------------------+
| DWORD |1 0 0 1 0 0 0 1|0 0 1 1 0 1 1 0|0 0 1 1 1 0 1 1|0 1 1 0 1 1 0 0|
| 2 | | (59) MASKED (108) |
| | Masking-key (part 2) |0 1 1 0 0 0 0 1|0 1 1 0 0 0 1 0|
| | (16 bits) | (97) 'a' UNMASKED (98) 'b' |
| | | Payload Data (part 1) |
+-------+-------------------------------+-------------------------------+
| DWORD |1 1 1 1 0 0 1 0|
| 3 | (242) MSK |
| |0 1 1 0 0 0 1 1|
| | (99) 'c' UNM |
| | Payload pt 2 |
+-------+---------------+