Language
日本語
English

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.

  1. Home
  2. Rust Dictionary

Rust Dictionary Index

[Setup] Rust Development EnvironmentSetup instructions for installing and running Rust.
let / mut / const / staticDeclares variables and constants with mutability control.
Ownership / MoveRust'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 TraitsDuplicates a value and the mechanism for implicit copying.
Drop Trait / Scope and DeallocationHow resources are released when a scope ends.
if / else / if letConditional branching and pattern-matching branches.
match / Pattern MatchingA syntax for branching a value across multiple patterns.
loop / while / forThree patterns of repetitive processing.
fn / Closures (|x| x+1)Defines and uses functions and closures.
Fn / FnMut / FnOnce TraitsThe three trait types of closures.
Function Pointers (fn) / Higher-Order FunctionsA way to treat a function as a value.
struct / Field DefinitionsDefines a struct and creates an instance.
impl / Method DefinitionsA way to add methods to a struct.
Struct Update Syntax / NestingCreates an instance from an existing one and supports nesting.
#[derive(Debug, Clone, PartialEq)]Commonly used derive attributes.
enum / Variant DefinitionsDefines an enum and the kinds of variants it can have.
impl enum / Pattern Branching with matchAdds methods to an enum and branches with match.
Data Modeling with enumPractical patterns for using enums.
trait / impl Trait for TypeDefines and implements a trait.
Trait Bounds / where ClauseA mechanism that requires a trait for a type parameter.
Display Trait / Debug TraitImplements traits for string formatting.
From / Into / TryFrom / TryInto TraitsTraits for type conversion.
Generics (<T>) / Type ParametersA mechanism that abstracts types for reuse.
Combining Generics and Trait BoundsPractical use of generics with constraints.
Option<T> / Some / NoneAn 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 / ErrAn enum that represents success or failure.
Result::unwrap() / expect() / ? OperatorExtracts a Result value and propagates errors.
Custom Error Types / thiserrorHow to define your own error type.
panic!() / unwrap() / expect() — When to Use EachChoosing 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 ConversionCasts between primitive types and numeric conversions.
Type Aliases (type) / Newtype PatternGives 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 / PathBufManipulates 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 ChannelMessage passing between threads.