Glossary
Every term the series has explained so far, in a sentence or two. Each one links to the section that explains it properly.
- arrayRust
A fixed number of values of one type, stored side by side. Its length is part of its type, so
[u8; 25]always holds exactly 25u8s.- attributeRust
A note to the compiler about the item after it, such as
#[test], which marks a function as a test.- constantRust
A named value that's fixed when the code compiles, declared with
const. Its name is written in capitals.- crateRust
One library or one program, and the unit
cargobuilds.- editionRust
The version of the Rust language a crate is written in, set in its
Cargo.toml. Editions let Rust improve without breaking older code.- functionRust
A named piece of code, declared with
fn, that takes arguments and can give back a value. Its last expression, written without a semicolon, is the value it returns.- macroRust
Code that writes code, called with a
!, likeassert_eq!. A macro can do things a function can't, such as take a varying number of arguments.- methodRust
A function that works on one value of a type. It's written inside
implwithselfas its first argument, and called with a dot, as inboard.tap(12).- modular arithmeticComputer science
Counting that wraps around after a fixed number, like the hours on a clock. Plus Out counts modulo 4, so 3 + 1 is 0.
- moduleRust
A named group of code inside a crate, made with
mod. It can be a block inside a file or a file of its own.- panicRust
Rust stopping a program, or a test, because something happened that must never happen, such as reading past the end of an array. It names the file and line where it happened.
- referenceRust
A way to borrow a value without copying or moving it, written with
&.&selfborrows a value to read it, and&mut selfborrows it to change it. Rust allows many readers or one changer at a time, never both.- row-major orderComputer science
Keeping a grid in one list, row after row. On a board
SIZEcells wide, the cell in rowrand columnchas indexr * SIZE + c.- structRust
A type made of named fields, declared with
struct.- traitRust
A set of abilities a type can have, such as
PartialEqfor comparing with==.#[derive(...)]writes the code for common traits, andimpl Default for Boardshows how to write it by hand.- variableRust
A name for a value, made with
let. It can't change unless it's made withlet mut.- vectorRust
A list that can grow, written
Vec.Vec::new()makes an empty one,pushadds an item at the end, andvec![1, 2, 3]makes one with items in it.- workspaceRust
A group of crates that belong together. They share one
targetfolder and oneCargo.lock.