Plus Out in Bevy

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 25 u8s.

Chapter 2 · A type for the board

attributeRust

A note to the compiler about the item after it, such as #[test], which marks a function as a test.

Chapter 1 · Run your first test

constantRust

A named value that's fixed when the code compiles, declared with const. Its name is written in capitals.

Chapter 1 · Give the board its shape

crateRust

One library or one program, and the unit cargo builds.

Chapter 1 · A workspace with one crate

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.

Chapter 1 · A workspace with one crate

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.

Chapter 2 · How do you make a board?

macroRust

Code that writes code, called with a !, like assert_eq!. A macro can do things a function can't, such as take a varying number of arguments.

Chapter 1 · Run your first test

methodRust

A function that works on one value of a type. It's written inside impl with self as its first argument, and called with a dot, as in board.tap(12).

Chapter 2 · Read a cell

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.

Chapter 1 · Give the board its shape

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.

Chapter 1 · Run your first test

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.

Chapter 2 · What happens if you read past the last cell?

referenceRust

A way to borrow a value without copying or moving it, written with &. &self borrows a value to read it, and &mut self borrows it to change it. Rust allows many readers or one changer at a time, never both.

Chapter 2 · Read a cell

row-major orderComputer science

Keeping a grid in one list, row after row. On a board SIZE cells wide, the cell in row r and column c has index r * SIZE + c.

Chapter 1 · How do you number 25 cells?

structRust

A type made of named fields, declared with struct.

Chapter 2 · A type for the board

traitRust

A set of abilities a type can have, such as PartialEq for comparing with ==. #[derive(...)] writes the code for common traits, and impl Default for Board shows how to write it by hand.

Chapter 2 · Four taps change nothing

variableRust

A name for a value, made with let. It can't change unless it's made with let mut.

Chapter 2 · Read a cell

vectorRust

A list that can grow, written Vec. Vec::new() makes an empty one, push adds an item at the end, and vec![1, 2, 3] makes one with items in it.

Chapter 2 · Which cells does a tap touch?

workspaceRust

A group of crates that belong together. They share one target folder and one Cargo.lock.

Chapter 1 · A workspace with one crate