Rust Bites: Glossary

keywords and terms

Generated with ChatGPT 4o + additions
Term Definition
Arc<T>Atomically reference-counted smart pointer for shared ownership of data across threads.
async/awaitKeywords used to write asynchronous code that is non-blocking and efficient.
Attribute (`#[...]`)Metadata applied to items like functions or structs to affect compilation or behavior.
BorrowingAccessing data without taking ownership, either immutably (&T) or mutably (&mut T).
Box<T>A smart pointer for heap allocation and ownership transfer.
CargoRust’s official build system and package manager.
ChannelMessage-passing primitive for thread communication; provided by std::sync::mpsc.
CloneA trait for making deep copies of data.
ClosureAn anonymous function that can capture variables from its enclosing scope.
ConversionType conversion via From, Into, TryFrom, and TryInto traits.
CopyMarker trait for types whose values are bitwise-copied rather than moved on assignment.
CrateA compilation unit in Rust; can be a library or executable.
Data StructureStandard collections including Vec<T>, HashMap, BTreeMap, and VecDeque from std::collections.
DeriveAutomatically implements traits using attributes like #[derive(Debug)].
DropA trait for customizing what happens when a value goes out of scope.
EnumA type that can be one of several defined variants, useful in pattern matching.
Error HandlingPrimarily done through Result<T, E> and panic!.
Fat PointerA pointer with additional metadata (e.g., for slices or trait objects).
File I/OReading and writing files using std::fs and types like File and BufReader.
for loopIterates over a range or any type implementing IntoIterator.
Function PointerA reference to a function, e.g., fn().
GenericsParametric types/functions using type parameters like <T>.
HashMapA key-value collection from std::collections.
HeapMemory allocated dynamically during runtime.
implDefines method implementations or trait implementations for a type.
Interior MutabilityPattern allowing mutation through a shared reference, using Cell<T> or RefCell<T>.
IntoIteratorA trait used in for loops to produce iterators from a value.
IteratorA trait providing next() for sequential element access; the basis of Rust's lazy iteration model.
Lifetime ('a)Specifies how long a reference is valid.
LoopAn infinite loop construct, terminated using break.
MacroMetaprogramming feature used to generate code (e.g., macro_rules!).
MatchPattern matching construct used for branching logic.
MethodFunction defined in an impl block and called via . on a value or reference.
Module (mod)Namespace construct for organizing code.
Move SemanticsTransfer of ownership when a non-Copy value is assigned or passed to a function.
MutexSynchronization primitive ensuring exclusive access to shared data across threads.
Option<T>Enum representing an optional value: Some(T) holds a value, None represents absence.
OwnershipEach value has a single owner responsible for its lifetime and cleanup.
Pattern MatchingUsed to destructure data using match, if let, or while let.
PointerA reference to data, either safe (&T) or raw (*const T).
Rc<T>Reference-counted smart pointer for shared ownership in single-threaded contexts.
ReferenceA non-owning pointer to a value, subject to borrowing rules.
Regular ExpressionPattern matching on strings via the regex crate.
Result<T, E>Enum used to represent success (Ok) or error (Err) states.
ShadowingRebinding a variable with a new value and possibly a new type.
SliceA view into a sequence of elements, e.g., &[T].
StringGrowable, heap-allocated UTF-8 text.
StructA custom type composed of named fields.
ThreadUnit of concurrent execution spawned via std::thread::spawn.
TraitA collection of method signatures that a type can implement.
Trait ObjectA dynamically dispatched instance of a trait, e.g., Box<dyn Trait>.
TupleA fixed-size collection of values of various types, e.g., (i32, f64).
Type InferenceCompiler deduction of variable types from context, enabling let x = 5 without an explicit annotation.
Unit TestTest function marked #[test], collected and run by cargo test.
UnsafeMarks code blocks that can bypass Rust’s safety checks.
Vec<T>A growable, heap-allocated array type.
Variable Binding (let)Declares variables; may be mutable with let mut.
Zero-cost AbstractionsRust abstractions incur no runtime overhead compared to equivalent low-level code.