Step Into Rust · Lesson 9 · Systems Rust
Bytes & Binary Data
u8 slices, byte strings, endianness conversions, parsing headers and checksums.
- ~30 minreading and coding
- 4missions
- membersaccess
- Rustlanguage
Part of Step Into Rust. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
Binary data in Rust is [u8; N] (a fixed array), Vec<u8> (owned, growable) or &[u8] (a borrowed slice). Byte-string literals give you bytes directly:
In this lesson
- Raw bytes
- Endianness, explicitly
- Slicing and parsing
- Arithmetic on bytes
Missions
- A hex dump
- Byte order
- Parse a header
- A wrapping checksum