Text, numbers and collections

A program is mostly text, numbers and the values it keeps while it runs. These twelve lessons start from the integer and float types and the bits of a char, then build a String and read it as a &str of UTF-8 bytes. Formatting and the printing macros follow, then the collections the standard library gives: Vec, the fixed array, and the tuple that returns several values. The chapter ends on the enums that carry data, Option and Result, which the rest of the course handles instead of null and an error code.

023 Integers, floats, overflow and casts the integer types and their ranges, float formats, checked and wrapping arithmetic, as casts (C++ 007, 008) Open 024 char, bytes and bit flags char as a Unicode scalar, bytes, bit masks as flags, shifts and a permission set (C++ 023, 075) Open 025 String: build, grow and search String and its heap buffer, push_str, format!, contains, replace and a word count (C++ 017) Open 026 &str, UTF-8 and characters a &str borrow, char_indices, bytes against chars, and why len() is not the character count (C++ 018, 075) Open 027 format! and format specifications named arguments, width, fill, alignment, precision, the debug trait and a text table (C++ 063, 066) Open 028 print!, println! and reading input stdout and stderr, print without a newline, reading a line from stdin and flushing (C++ 064) Open 029 Vec: push, index and grow push, index and get, len against capacity, reserve, remove and the cost of growing (C++ 019) Open 030 Arrays and fixed-size buffers [T; N] on the stack, iteration, indexing that panics, and a function generic over the length (C++ 020) Open 031 Tuples and several return values tuple types, destructuring, returning two values, the unit type and the tuple struct (C++ 060) Open 032 Enums with data variants that carry values, match over them, Option and Result as enums, and a small expression tree (C++ 022, 062) Open 033 Option and its combinators Some and None, unwrap_or, map, and_then, the question mark on Option and a lookup that may fail (C++ 061) Open 034 Result and the question mark Ok and Err, ? in a function, main that returns Result, map_err and a parse that reports why it failed (C++ 081) Open

Lessons