Step Into Labs

Step Into Rust · Lesson 9 · Systems Rust

Bytes & Binary Data

u8 slices, byte strings, endianness conversions, parsing headers and checksums.

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

Missions

  1. A hex dump
  2. Byte order
  3. Parse a header
  4. A wrapping checksum