Glossary: Rust words in plain English
You will meet words in Rust code, compiler messages and docs that no other language uses. This page gives each a plain meaning, the closest idea you may already know, and the lesson section that teaches it. Symbols come first, then A to Z. A word that a lesson only mentions in passing is explained in one line here.
Symbols
Section titled “Symbols”| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
'a |
A lifetime name that ties a returned reference to the inputs it borrows from. | None in Go, Java, Kotlin, C#, Python or TypeScript. | Lifetimes |
'static |
A lifetime that lasts the whole run of the program; as a bound, T: 'static means T holds no borrow that could end early. |
Not C’s static. |
Lifetimes |
? |
After a Result or an Option, it takes the value out, or returns the failure from the whole function right now. |
Go: the if err != nil { return err } pair, in one character. Not a ternary, not ?.. |
Errors and Result |
! after a name |
Marks a macro call, as in println!. |
C: nothing at the call shows a macro. | Macros, attributes and comments |
&T |
A shared reference: the address of a value that already exists, read-only, owning nothing. | C++: close to const T&, but the compiler checks it cannot outlive the value. |
Borrowing |
&mut T |
A mutable reference: it may change the value it points at, and while it exists nothing else may use that value. | C#: ref is the nearest form. C++: close to T&, with the one-writer rule checked. |
Mutable Borrows |
:: |
Walks a path to a name, such as a module, a type or a function; . works on a value you hold. |
C++: :: is also a path. |
Rust at a glance |
@ |
In a pattern, tests a pattern and names the value in one step, as in n @ 1..=9. |
Python: case 1 | 2 | 3 as n in match. |
Match |
_ |
A pattern that fits anything and binds nothing; _name is a real variable that only silences the unused warning. |
Go and Python: _. |
Patterns |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
as |
Converts between simple types, mostly numbers; it never fails at run time, so it can lose information. | C: a cast such as (int)x, but every case is defined (no undefined behaviour). |
Numbers and Types |
| associated function | A function in an impl with no self, called with :: on the type, like Account::new. |
Java, C#: a static method. Kotlin: a companion-object function. | Methods |
| associated type | A type that a trait leaves for each implementing type to choose, like Item in Iterator. |
Close to an interface’s type parameter, but the implementer fixes it once. | Traits |
async |
Marks a function or block whose body becomes a future: nothing runs until it is .awaited or handed to a runtime, and the standard library has no runtime. |
C#, Python, TypeScript: async and await. Python coroutines are also lazy; C# tasks and JavaScript promises start at once. |
Async Basics, Async with Tokio |
| attribute | A note to the compiler about the item after it, written #[...], or #![...] for the item it sits inside. |
Java: annotation. C#: attribute. Not a Python decorator. | Macros, attributes and comments |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| binding mode (default binding modes, match ergonomics) | When you match a reference against a pattern that is not a reference, Rust looks through it and makes each name a reference too. | None. | Patterns |
| borrow | To make a reference to a value you do not own; it lasts until the reference’s last use. | C++: close to passing a const T&, but the compiler checks how long it lives. |
Borrowing |
| borrow checker | The part of the compiler that checks every borrow. | None in your languages. | Borrowing |
Box<T> |
An owned pointer to one T on the heap; the value is freed when the box is dropped. |
C++: std::unique_ptr<T>. |
Ownership and Moves |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| Cargo | Rust’s build tool and package manager: cargo new, cargo run, cargo build. |
Go: the go command. C#: dotnet. Node: npm. |
Hello World |
Cargo.toml (manifest) |
The file that holds a package’s name, version, edition and dependencies. | package.json, go.mod, pom.xml. |
Hello World |
Cell, RefCell |
Types that change a value through a plain let or a shared reference; Cell copies values in and out, RefCell checks the borrow rules while the program runs. |
None. C++: a mutable member does the same job for a const object. |
Smart pointers |
char |
One Unicode scalar value, 4 bytes wide. It is not a byte. | Go: rune. Not C’s or Java’s char. |
Declarations and types |
Clone |
A trait with .clone(), an explicit copy that may run any code. |
C++: close to a copy constructor, but it runs only when you call it. | Ownership and Moves |
| closure | A small function written inline, as |x| x + 1, that can use the variables around it. |
Lambda in Java, Kotlin, C#, Python, TypeScript. Go: a func literal. | Closures |
const |
A name for a value known before the program runs, copied into every place that uses it. | Go and C#: const. |
Variables |
| const generic | A generic parameter that is an integer, char or bool, known when the program is compiled, such as the length of an array. |
C++: a non-type template parameter. | Generics |
| constructor | Rust has none; a plain function that returns the struct does the job, and new is only a habit. |
A static factory method. Go: a NewX function, the same habit. |
Methods |
Copy |
A trait for types that a plain bit-for-bit copy duplicates, so let b = a; leaves a usable. |
Go struct assignment always copies; in Rust you opt in. | Ownership and Moves |
| crate | One unit of compilation: a program or a library, made of a tree of modules. | Java, Kotlin: a module. C#: an assembly. | Modules and Visibility |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| dangling reference | A reference to something that is gone; in safe Rust the compiler refuses a program that would make one. | C and C++: dangling pointers compile. | Borrowing |
| data race | Two threads using the same memory at the same time, at least one writing, with nothing coordinating them. | The same term in Go, Java and C++; in C++ it is undefined behaviour. | Mutable Borrows, Shared state |
Debug |
The trait behind {:?}: a form meant for programmers, which #[derive(Debug)] writes for you. |
Python: repr. Go: close to %v. |
Macros, attributes and comments |
Default |
A trait that makes a “blank” value, for T::default() and ..Default::default(). |
Close to Go’s zero value, but only types that opt in have one. | Common Traits |
| deref coercion | Where the type is known, the compiler turns a &String into a &str, and a &Vec<T> into a &[T], by itself. |
None. | Borrowing |
| derive | #[derive(...)] asks the compiler to write standard trait code for a type from its fields. |
Close to a Kotlin data class or Java record, but those also declare the fields and constructor; derive only adds trait code to a struct you declare, and you pick each trait. |
Structs |
| destructuring | Taking a value apart with a pattern, so each name gets its part. | Python: unpacking. TypeScript: destructuring. C#: deconstruction. | Patterns |
| discriminant | The number each variant of a data-free enum has, starting at 0 or at the value you give it. | C: the value of an enum constant. Java: ordinal(). |
Enums |
Display |
The trait behind {} and .to_string(): text for the people who use the program, which you write yourself. |
Java: toString(). Python: __str__. Go: String(). |
Common Traits |
Drop |
A trait whose drop method runs when a value goes out of scope. |
C++: a destructor. Go: defer is close. |
Ownership and Moves |
dyn |
Marks a type known only by the trait it has; which method runs is looked up at run time. | Go: an interface value. Java: an interface reference. | Trait Objects |
| dynamic dispatch | Choosing the method to run at run time, through a vtable. | Java: an ordinary interface call. C++: a virtual call. | Traits |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| edition | A named set of language rules that a package picks in Cargo.toml, so Rust can change without breaking old code. |
C++: the -std= choice is close. |
Hello World |
| elision (lifetime elision) | The compiler fills in lifetimes by three fixed rules, so you often write none. | None. | Lifetimes |
| enum | A type that is exactly one of a fixed list of variants, and each variant can carry its own data. | Kotlin: sealed class. Java: sealed interface and records. Not a plain C enum. |
Enums |
| exhaustive | A match must cover every possible value, and the compiler checks it. |
Kotlin when and Java switch over a sealed type. |
Match |
| expression | Code that produces a value; in Rust if, match, loop and blocks are expressions too. |
The same word. Kotlin: if and when are expressions too. Elsewhere if is a statement. |
Statements and expressions |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| fat pointer | A pointer plus a second word: for a slice or &str, the length; for dyn, the address of the vtable. |
Go: an interface value is also two words. | Trait Objects |
Fn, FnMut, FnOnce |
Three traits; each closure gets the ones its body allows: Fn if it only reads what it captured, FnMut if it changes it, FnOnce if it gives it away (a closure that gives something away is only FnOnce). |
None. | Closures |
From, Into |
From converts one type into another without failing; implement it and .into() comes free. |
C++: a converting constructor is close, but those are implicit; Rust conversions are always written (.into()). |
Common Traits |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| generic | Written once with a placeholder type such as T, which the compiler fills in at each call. |
Generics in Java, Kotlin, C# and Go. C++ templates are closest. | Generics |
| guard | An if condition after a pattern; the arm runs only if the pattern fits and the condition is true. |
Python: case n if .... C#: when. |
Match |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
Hash |
A trait that feeds a value into a hasher; a HashMap key or HashSet item needs Hash and Eq (a BTreeMap key needs Ord). |
Java: hashCode(). C#: GetHashCode(). Python: __hash__. |
Common Traits |
| heap | A large pool of memory the program asks an allocator for while it runs; String, Vec and Box own heap data. |
C and C++: the same heap. | Values, the Stack and the Heap |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
impl |
A block that gives a type its methods, or impl Trait for Type that gives it a trait’s methods. |
Go: methods declared outside the struct. | Methods |
impl Trait |
In a parameter, shorthand for a bounded type parameter; in a result, one type the function chooses and hides. | The parameter form: Java’s <T extends X>. |
Traits |
| interior mutability | Types that change data through a shared & on purpose, and stay safe by other means. |
C++: mutable members are close. |
Borrowing |
IntoIterator |
The trait for “can become an iterator”; for x in v calls it. |
Java: Iterable. Python: an iterable. |
Iterators |
| irrefutable | A pattern that fits every value of its type, so let and for accept it. |
None. | Patterns |
| iterator | Anything with a next() method that returns Some(item) until it returns None. |
Java: Iterator, with hasNext and next in one call. |
Iterators |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| lazy | An iterator chain only describes the work; nothing runs until something at the end pulls items through. | Java streams, C# LINQ, Python generators. | Iterators |
| let chain | An if let joined with more tests by &&; it needs edition 2024. |
None. | If / Else |
let ... else |
Unpacks a pattern, or runs an else block that must leave. |
None. | If / Else |
| lifetime | How long a reference may be used: a region of the program that must fit inside the life of the value it points at. | None in garbage-collected languages. C++: “lifetime” means an object’s own life; a Rust lifetime belongs to a borrow. | Lifetimes |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| macro | Code that the compiler expands into other code before it checks types; the ! marks a call. |
C: a preprocessor macro, but this one takes tokens, not text. | Macros, attributes and comments |
match |
Compares one value with a list of patterns and gives the value of the first that fits; it must cover every case. | Kotlin when, Java and C# switch expressions, Python match. A C-style switch is further off: it only compares numbers. |
Match |
| method | A function with a self first parameter, defined in an impl and called with a dot. |
A method, as in Java, Kotlin, C# and Python. | Methods |
| module | A named group of items that hides whatever you do not mark pub; it is also the privacy boundary. |
Go, Java: a package. C#: a namespace (not a privacy line). Rust’s module is also the privacy line: a child module sees its parent’s private items. | Modules and Visibility |
| monomorphization | The compiler writes a separate copy of a generic function for each type it is used with. | C++: template instantiation. | Generics |
| move | Handing a value to a new owner; the old name can no longer be used. | C++: std::move, but using a moved-from value does not compile here. |
Ownership and Moves |
move (closure) |
Before the bars of a closure, makes it take every variable it uses by value. | None. | Closures |
mut |
Lets a variable change; it belongs to the name, not to the value. | Kotlin: var. Java: a variable that is not final. But Kotlin val and Java final stop only reassignment; Rust’s plain let also stops changing the contents. |
Variables |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
never type (!) |
The type of return, break, continue and panic!, which never produce a value, so they fit where any type is expected. |
Kotlin: Nothing. |
Statements and expressions |
| newtype | A tuple struct with one field: a new type to the compiler, the size of the type inside. | Go: type Meters float64 is close. Kotlin: a value class. |
Structs |
| niche | A bit pattern a type never uses, which the compiler reuses to mean “no value” (None), so Option<&T> is the size of &T. |
None. | Enums |
| NLL (non-lexical lifetimes) | The borrow checker’s design that ends a borrow at the last use of the reference, not at the end of the block. | None. | Lifetimes |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
Option |
An enum that is Some(value) or None; safe Rust has no null references. |
Close to Java’s Optional<T> or Kotlin’s T?. |
Option |
| orphan rule | You may write impl Trait for Type if the trait or the type is defined in your own crate (a type of yours among the trait’s own type parameters also counts); otherwise it is refused. |
None. | Traits |
| overflow | A result outside its number type’s range: by default a panic in a debug build and a wrap in a release build. | Java, Go and C# (by default) wrap silently. C, C++: signed overflow is undefined behaviour. Python has no overflow. | Numbers and Types |
| owned vs borrowed | An owned value is held, and freed, by its owner; a borrowed one is a reference to a value someone else owns. | C++: std::string against std::string_view. |
Strings |
| ownership | Every value has one owner, a handoff moves it, and it is dropped when its owner goes out of scope. | C++: RAII, but enforced by the compiler. | Ownership and Moves |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| package | A Cargo.toml with one or more crates beside it. |
An npm package, not a Java or Go package. |
Modules and Visibility |
| panic | Stops the thread (the program, on the main thread) with a message; it is for bugs, not for expected failures. | Go: panic, but an unrecovered Go panic in any goroutine ends the whole program; a Rust panic ends only its thread. Java: an exception that nothing catches. |
Errors and Result |
PartialEq, Eq |
PartialEq gives ==; Eq is the promise that a value equals itself, which f64 cannot make because of NaN. |
Java: equals(). Python: __eq__. |
Common Traits |
| partial move | Moving one field out of a struct you own; the other fields stay usable but the whole struct does not. | None. | Ownership and Moves |
PartialOrd, Ord |
PartialOrd gives < and >; Ord is the full order that sort and max need. |
Java: Comparable. C#: IComparable. |
Common Traits |
| path | A name for an item reached by walking through modules with ::. |
An import path, as in Python or Java. | Reading a function signature |
| pattern | A shape a value can have, with names where you want to keep a part. | Python: match. C#: patterns. TypeScript: destructuring. |
Match |
| prelude | The short list of names every module gets without writing use. |
Python: the builtins. Java: java.lang. |
Modules and Visibility |
pub |
Makes an item visible outside its module; everything is private by default. | Java, C#: public. Go: a capital letter. |
Modules and Visibility |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| RAII | A resource is released when the value that owns it goes out of scope; Rust does this with Drop. |
C++: RAII. C# using and Java try-with-resources are the manual version (the caller has to remember to write it). |
Ownership and Moves |
Rc, Arc |
Pointers for several owners of one value: each clone adds an owner, and the value is freed when the last goes. Arc is the thread-safe one. |
C++: std::shared_ptr, but Rc gives read-only access, while a shared_ptr lets every owner change the value. |
Ownership and Moves, Shared state |
| reference | The address of a value that already exists, copying nothing and owning nothing. | C++: close to a reference, but checked. Not a Java object reference. | Borrowing |
| refutable | A pattern that can fail to fit, such as Some(n). |
None. | Patterns |
Result |
An enum that is Ok(value) when things worked or Err(error) when they did not. |
Go: close to the (value, error) pair, but it is one value. |
Errors and Result |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
self, Self |
In a method, self is the value it is called on and Self is the type itself. |
this in Java and C#. Python: self, written out too. |
Methods |
Send, Sync |
Traits for threads. Send: a value of the type may be moved to another thread. Sync: a shared reference &T may be used from several threads (T is Sync when &T is Send). |
None in your languages. | Send and Sync |
| shadowing | Writing let again with the same name makes a new variable that hides the old one; the type may change. |
Go, Kotlin, TypeScript, C, C++: inner scopes only. Java and C# refuse even that. Rust allows the same scope too. | Variables |
Sized |
A trait for types whose size is known when compiled; every type parameter has it unless you write ?Sized. |
None. | Generics |
| slice | A borrowed view of items stored in a row: an address and a length, written &[T]. |
Go: close to a slice, but it has no capacity and is borrow-checked. Python: a slice is a copy; a Rust slice is a view. | Vectors and Slices |
| slice pattern | A pattern that describes a list by its shape, like [first, .., last]. |
Python: [first, *rest] in match. |
Match |
| smart pointer | A type that owns a value behind a pointer, such as Box, Rc and Arc. |
C++: smart pointers, the same term. | Smart pointers |
| stack | The memory that holds each call’s frame; fast, and everything on it has a size known when compiled. | The call stack in every language. In Java, Kotlin, Python and TypeScript objects live on the heap and the stack holds references to them. | Values, the Stack and the Heap |
| statement | An instruction that does something and produces no value, such as let x = 7;. |
The same word. | Statements and expressions |
static |
A value stored once for the whole program, so every reference points to one place. | Java: a static final field. Go: a package-level var, which Go lets you assign and Rust does not. |
Variables |
| static dispatch | The compiler knows which method each call runs, because each call is for one type. | C++: a non-virtual call. | Traits |
&str |
Read-only text you borrow from someone else; a pointer and a length. String literals are &str. |
Go: string. C++: std::string_view. |
Strings |
String |
Text you own, held on the heap, that can grow. | Closest: StringBuilder in Java and Kotlin, or std::string in C++. |
Strings |
| struct | A type that groups named values, its fields, under one name. | Go and C: struct. C#: struct. |
Structs |
| struct update syntax | ..base at the end of a struct literal takes the unlisted fields from another value. |
TypeScript: { ...base, x: 1 }, but the spread goes first; Rust’s ..base goes last and moves any non-Copy field out of base. |
Structs |
| supertrait | A trait that requires another, as in trait Pet: Speaker; it is a promise, not inheritance. |
Java: an interface that extends another, but a Rust type still needs its own impl of each trait. |
Traits |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| tail expression | The last expression of a block, with no ;; it is the block’s value. |
The last line of a Kotlin lambda. | Statements and expressions |
| trait | A named set of methods that a type can have, added with impl Trait for Type. |
Java, Kotlin, C#: an interface. Go: an interface, but a Rust type must say it implements it. | Traits |
| trait bound | A requirement on a type parameter, such as T: Display. |
Java: T extends Comparable<T>. C#: where. C++20: a concept. |
Traits |
| trait object | A value of some type that implements a trait, where the code no longer knows which; written dyn Trait. |
Go: an interface value. Java: an interface reference. | Trait Objects |
TryFrom |
A conversion that can fail and returns a Result. |
C#: the same try-style idea as TryParse, but for converting between types; text uses parse. |
Common Traits |
| tuple | A fixed number of values, each slot with its own type. | Python: a tuple. Kotlin: Pair. |
Multiple Return Values |
| tuple struct | A struct whose fields have positions, not names, as in struct Meters(f64);. |
None. | Structs |
| turbofish | ::<T>, which gives a type argument inside an expression, as in parse::<i32>(). |
Kotlin and C++ write f<T>(); Rust needs the ::. |
Declarations and types |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
unit (()) |
The type with exactly one value, also written (): Rust’s “nothing”, which you can store. |
Kotlin: Unit. Python: None is the closest relative. |
Statements and expressions |
unsafe |
A block (or an unsafe fn or unsafe impl) where you promise the compiler you checked what it cannot. |
C#: unsafe blocks. Rust’s unsafe does not switch off the borrow checker; it only unlocks a few extra operations. |
What Rust leaves out |
| unwinding | By default, on a panic, Rust walks back up the call stack and cleans up each function’s values. | C++, Java, C#: stack unwinding when an exception propagates. | Errors and Result |
unwrap, expect |
Take the value out of an Option or Result, and panic on None or Err; expect adds your message. |
Kotlin: !!. Java: Optional.get(). |
Errors and Result |
use |
Gives a path a shorter name in the module (or block) where you write it; it loads nothing. | Java: import, which also only shortens names. Python, TypeScript: import also loads the module. |
Splitting code into files |
usize |
The unsigned integer as wide as a memory address; lengths and indexes use it. | C and C++: size_t. |
Numbers and Types |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| variant | One of the named forms of an enum, such as Some or Quit. |
Kotlin: a subclass of a sealed class, but a Rust variant is not a type of its own. | Enums |
Vec<T> |
A growable list of T on the heap: a pointer, a length and a capacity. |
C++: std::vector. Java: ArrayList. |
Vectors and Slices |
| vtable | A table of a type’s method addresses for one trait; a dyn pointer holds its address. |
C++: the same idea, but the pointer lives in every object; Rust keeps it in the dyn pointer. |
Trait Objects |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
where |
Lists, after a signature, what a generic type must be able to do. | C#: where. C++20: requires. |
Traits |
| workspace | Several packages that share a Cargo.lock and a target/ folder. |
npm workspaces. Go: go.work. |
Modules and Visibility |
| Word | Plain meaning | You may know it as | Taught in |
|---|---|---|---|
| ZST (zero-sized type) | A type whose values take no space, such as (), a unit struct, or a closure that captures nothing. |
Go: struct{}. |
Structs |
Learn Rust is an independent project, not affiliated with the Rust Project or the Rust Foundation. Code and text are under the MIT licence.Source on GitHub.