Caution
JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.
Dictionary
- Home
- Rust Dictionary
Rust Dictionary Index
| [Setup] Rust Development Environment | Setup instructions for installing and running Rust. |
| let / mut / const / static | Declares variables and constants with mutability control. |
| Ownership / Move | Rust's unique rule that each value has exactly one owner. |
| Borrowing / References (&) | A mechanism for referencing a value without taking ownership. |
| Lifetimes ('a) | An annotation that explicitly specifies the validity period of a reference. |
| Clone / Copy Traits | Duplicates a value and the mechanism for implicit copying. |
| Drop Trait / Scope and Deallocation | How resources are released when a scope ends. |
| if / else / if let | Conditional branching and pattern-matching branches. |
| match / Pattern Matching | A syntax for branching a value across multiple patterns. |
| loop / while / for | Three patterns of repetitive processing. |
| fn / Closures (|x| x+1) | Defines and uses functions and closures. |
| Fn / FnMut / FnOnce Traits | The three trait types of closures. |
| Function Pointers (fn) / Higher-Order Functions | A way to treat a function as a value. |
| struct / Field Definitions | Defines a struct and creates an instance. |
| impl / Method Definitions | A way to add methods to a struct. |
| Struct Update Syntax / Nesting | Creates an instance from an existing one and supports nesting. |
| #[derive(Debug, Clone, PartialEq)] | Commonly used derive attributes. |
| enum / Variant Definitions | Defines an enum and the kinds of variants it can have. |
| impl enum / Pattern Branching with match | Adds methods to an enum and branches with match. |
| Data Modeling with enum | Practical patterns for using enums. |
| trait / impl Trait for Type | Defines and implements a trait. |
| Trait Bounds / where Clause | A mechanism that requires a trait for a type parameter. |
| Display Trait / Debug Trait | Implements traits for string formatting. |
| From / Into / TryFrom / TryInto Traits | Traits for type conversion. |
| Generics (<T>) / Type Parameters | A mechanism that abstracts types for reuse. |
| Combining Generics and Trait Bounds | Practical use of generics with constraints. |
| Option<T> / Some / None | An enum that represents the presence or absence of a value. |
| Option::unwrap() / expect() / unwrap_or() | Ways to extract a value from an Option. |
| Option::map() / and_then() / is_some() | Transforms and chains Option values. |
| Result<T, E> / Ok / Err | An enum that represents success or failure. |
| Result::unwrap() / expect() / ? Operator | Extracts a Result value and propagates errors. |
| Custom Error Types / thiserror | How to define your own error type. |
| panic!() / unwrap() / expect() — When to Use Each | Choosing between panics and recoverable errors. |
| String::from() / to_string() | Ways to create a String. |
| String::push_str() / push() / + | Concatenates and appends to strings. |
| String::len() / is_empty() / contains() | Gets the length, searches, and checks string values. |
| String::replace() / split() / trim() | Replaces, splits, and trims strings. |
| String::chars() / bytes() / parse() | Iterates over and converts strings. |
| Slices (&str / &[T]) | A reference to a portion of a string or array. |
| Vec::new() / vec![] | Ways to create a Vec. |
| Vec::push() / pop() / insert() / remove() | Adds and removes elements. |
| Vec::len() / is_empty() / contains() / get() | Retrieves, searches, and checks elements. |
| Vec::sort() / dedup() / extend() / drain() | Sorts, removes duplicates, concatenates, and splits. |
| vec![] / assert!() / assert_eq!() / dbg!() | Commonly used utility macros. |
| HashMap::new() / insert() / get() | Creates a HashMap and inserts and retrieves entries. |
| HashMap::contains_key() / remove() / entry() | Checks for key existence, removes entries, and uses or_insert. |
| HashMap::keys() / values() / iter() | Iterates and loops over a HashMap. |
| iter() / iter_mut() / into_iter() | Three ways to obtain an iterator. |
| Iterator::map() / filter() | Transforms and filters elements. |
| Iterator::collect() / count() / sum() | Terminal operations on an iterator for collecting and aggregating. |
| Iterator::enumerate() / zip() / flat_map() | Combines iterators. |
| Iterator::fold() / any() / all() / find() | Fold operations and searching. |
| as Casting / Numeric Type Conversion | Casts between primitive types and numeric conversions. |
| Type Aliases (type) / Newtype Pattern | Gives a type an alias or wraps it in a newtype. |
| println!() / print!() / format!() / eprintln!() | Macros for output and string generation. |
| std::io::stdin() / stdout() | Reads from and writes to standard input and output. |
| std::fs::read_to_string() / write() | A simplified way to read and write files. |
| File::open() / File::create() | Reads and writes using a File handle. |
| std::path::Path / PathBuf | Manipulates file paths. |
| Box<T> | A smart pointer that places a value on the heap. |
| Rc<T> / Arc<T> | Multiple ownership through reference counting. |
| RefCell<T> / Cell<T> | Runtime borrow checking for interior mutability. |
| Rc<RefCell<T>> / Arc<Mutex<T>> | Combining multiple ownership with interior mutability. |
| std::thread::spawn() / join() | Spawns a thread and waits for it to finish. |
| Mutex<T> / RwLock<T> | A mechanism for safely sharing data between threads. |
| std::sync::mpsc Channel | Message passing between threads. |