Rust Bites: Glossary

keywords and terms

Generated with ChatGPT 4o
Term Definition
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.
CloneA trait for making deep copies of data.
CrateA compilation unit in Rust; can be a library or executable.
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).
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.
IntoIteratorA trait used in for loops to produce iterators from a value.
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.
Module (mod)Namespace construct for organizing code.
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).
ReferenceA non-owning pointer to a value, subject to borrowing rules.
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.
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).
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.