Rust Language

A concise guide to Rust’s core features, focusing on practical skills for modern, reliable systems development.

Rust gives developers a fast, dependable foundation for building modern systems, and this guide focuses directly on the practical skills you’ll use every day. Instead of covering the language’s background or evolution, we’ll move straight into the core features that matter for real-world development.

These tutorials assume basic Rust familiarity — you can write a struct, use match, and read a function signature. The focus is on idiomatic patterns, best practices, and common scenarios encountered in production code.


Learning Path

  1. Working With the Borrow Checker — common ownership scenarios and the patterns that resolve them
  2. Iterators Over Loops — when and how to use iterator chains idiomatically
  3. Error Handling in PracticeResult, ?, and real error management
  4. Strings: Choosing the Right Type&str, String, and Cow<str>
  5. Smart Pointers DemystifiedBox, Rc, Arc through concrete use cases
  6. Trait Objects vs Generics — when to use dyn Trait vs <T: Trait>
  7. Lifetimes in Practice — when annotations are needed and the patterns that resolve them
  8. Concurrency in Practice — threads, Send/Sync, channels, and the deadlocks to avoid
  9. Async/Await with Tokio — futures, the runtime, spawning tasks, and avoiding blocking calls
  10. Closures and Fn Traits — capturing the environment, FnOnce/FnMut/Fn, and returning closures
  11. Testing in Practice — unit vs integration tests, mocking with traits, and test fixtures
  12. Collections Deep DiveVec, HashMap vs BTreeMap, the Entry API, and VecDeque
  13. Pattern Matching Deep Dive — guards, @ bindings, or-patterns, and let else
  14. Derive Macros and Common Traits — what Debug, Clone, Eq, Hash, Ord, and Default actually generate, and when to hand-implement instead
  15. Newtype Pattern and From/Into Conversions — type-safe wrappers, the orphan rule, and idiomatic conversions
  16. Builder Pattern and Typestate — fluent builders, required fields, and encoding valid state transitions in the type system
  17. Operator Overloadingstd::ops traits, avoiding forced clones, and when an operator is the wrong choice
  18. Implementing Your Own Iterator — the Iterator/IntoIterator traits, size_hint, and well-behaved exhaustion
  19. Serde and JSON in Practice — field renaming, optional fields, custom formats, and tagged enums
  20. Unsafe Rust Basics — what unsafe actually unlocks, raw pointers, and wrapping unsafety in a safe API
  21. Modules and Project Organization — visibility levels, re-exporting, and when to split into a workspace
  22. Generics and Trait Bounds Deep Divewhere clauses, conditional and blanket impls, and associated types
  23. Declarative Macros (macro_rules!) — matching syntax, fragment specifiers, repetition, hygiene, and when not to reach for a macro
  24. Drop, RAII, and Resource Cleanup — the Drop trait, drop order, early drop, guard patterns, and suppressing cleanup
  25. Cargo Features and Conditional Compilation — feature flags, optional dependencies, #[cfg], and feature unification
  26. FFI — Calling C from Rustextern blocks, #[repr(C)], string conversion, and ownership across the boundary
  27. Const Generics and const fn — parameterizing over values, compile-time evaluation, and the const subset
  28. Trait Inheritance and Supertraits — supertrait bounds, default methods, and composing small traits
  29. Performance and Avoiding Allocations — measuring first, the .clone() reflex, capacity reservation, and Cow
  30. Error Libraries — thiserror and anyhow#[from] conversion, source chains, .context(), and downcasting
  31. Logging and Tracing — the log facade, tracing spans, structured fields, and #[instrument]
  32. Building CLIs with clap — the derive API, positionals/options/flags, subcommands as enums, and type-driven validation
  33. Interior MutabilityCell, RefCell, Mutex/RwLock, and OnceLock/LazyLock for mutating behind &self
  34. Deref, AsRef, and Borrow — deref coercion, flexible AsRef parameters, and the Borrow key-lookup trick
  35. Data Parallelism with Rayonpar_iter(), join/scope, parallel sort, and when the overhead isn't worth it
  36. Procedural Macros — derive/attribute/function-like macros, the syn + quote workflow, and spanned errors
  37. Async Channels and select!mpsc/oneshot/broadcast/watch, racing futures with select!, and drop-as-cancellation
  38. Sealed Traits and API Evolution — sealed traits, #[non_exhaustive], and what is/isn't a semver break
  39. TryFrom and Fallible ConversionsTryFrom/TryInto, the From vs TryFrom split, and "parse, don't validate"
  40. PhantomData and Marker Types — zero-sized markers, PhantomData, and compile-time units/state machines
  41. Slices, Chunks, and Windows&[T] views, chunks/windows, split_at_mut, and binary_search
  42. Send and Sync Deep Dive — the two thread-safety auto traits, why Rc/RefCell opt out, and the Send + 'static spawn bound
  43. Iterator Adapters Deep Divescan, peekable, take_while, zip/chain/step_by, and partition/unzip
  44. Build Scripts (build.rs) — running code before compilation, cargo: directives, OUT_DIR codegen, and rebuild tracking
  45. Option and Result Combinatorsmap/and_then, bridging with ok_or, and the eager-vs-lazy _or_else trap
  46. Enums as State Machines — replacing boolean soup with data-carrying variants and self-consuming transitions
  47. Sorting and Orderingsort_by_key/sort_by, stable vs unstable, Ord derivation, floats, and multi-key sorts
  48. Default and Construction — the Default trait, ..Default::default() struct-update, and when to prefer a builder
  49. The Read and Write Traits — unified byte I/O, BufReader/BufWriter, the flush trap, and generic impl Read/impl Write
  50. Working with TimeInstant vs SystemTime, Duration arithmetic without panics, and where chrono begins
  51. Trait Method Resolution — inherent-vs-trait priority, auto-ref/deref, ambiguity, and fully-qualified syntax
  52. Custom Hash and Eq — the Hash/Eq contract, hashing a subset of fields, and newtype keys
  53. FromIterator and collect — how collect picks its type, collecting into Result/HashMap/String, and custom targets
  54. Cargo Dependency Management — version ranges, the lockfile, duplicate versions, and feature unification across the tree
  55. Type Aliases and Associated Constants — aliases vs newtypes, type Result<T>, and constants attached to types and traits
  56. Exit Codes and Process Controlmain return types, ExitCode, the process::exit destructor trap, and reading the environment
  57. The Never Type!, the coercion rule behind panic!/return in expressions, the divergence macros, and Infallible
  58. Function Pointers vs Closuresfn pointers vs Fn closures, the non-capturing coercion, and where each fits
  59. Formatting: Display and DebugDebug vs Display, implementing fmt, the format-spec language, and inline capture
  60. Documentation and Doctests/// vs //!, examples tested by cargo test, hiding setup, and doc conventions
  61. Filesystem and PathsPath/PathBuf, portable join, non-UTF-8 paths, and std::fs read/write
  62. Pin and Self-Referential Types — why futures can't move, Pin/Unpin, and Box::pin/pin! in practice

By Theme

Prefer to explore by area? The same tutorials grouped by topic. The numbered path above is the recommended reading order; each tutorial links back to any it builds on.

Ownership, Borrowing & MemoryBorrow Checker · Strings · Smart Pointers · Lifetimes · Drop & RAII · Interior Mutability

Traits, Generics & ConversionsTrait Objects vs Generics · Newtype & Conversions · Operator Overloading · Generics & Trait Bounds · Const Generics · Supertraits · Deref, AsRef & Borrow · Sealed Traits · TryFrom · Method Resolution · Type Aliases & Assoc Consts

Iterators & ClosuresIterators Over Loops · Closures & Fn Traits · Implementing an Iterator · Iterator Adapters · FromIterator & collect · Function Pointers vs Closures

Error HandlingError Handling in Practice · thiserror & anyhow · Option/Result Combinators · The Never Type

Data Modeling & Pattern MatchingPattern Matching · Builder & Typestate · PhantomData & Markers · Enums as State Machines · Default & Construction

Collections & Data StructuresCollections · Slices, Chunks & Windows · Sorting & Ordering · Custom Hash & Eq

Concurrency & AsyncConcurrency · Async/Await with Tokio · Data Parallelism with Rayon · Async Channels & select! · Send & Sync · Pin

Macros & MetaprogrammingDerive Macros · Declarative Macros · Procedural Macros

Systems & I/OSerde & JSON · Unsafe Rust · FFI · Read & Write · Working with Time · Exit Codes & Process · Filesystem & Paths

Project, Tooling & ObservabilityTesting · Modules & Organization · Cargo Features · Performance · Logging & Tracing · CLIs with clap · Build Scripts · Cargo Dependencies · Formatting · Docs & Doctests