🦀

WIA Rust Intermediate Standard

Advanced Rust Programming Concepts & Patterns

弘益人間 - Benefit All Humanity

Trait System
Error Handling
Collections
Pattern Matching
Smart Pointers

🔧 Trait System Explorer

Explore Rust's powerful trait system: generics, trait bounds, and polymorphism

Basic Traits

Define behavior with trait methods

Generics

Write flexible, reusable code

Trait Bounds

Constrain generic types

Associated Types

Define type placeholders in traits

Interactive Trait Example

⚠️ Error Handling Patterns

Master Result, Option, and custom error types

Result

Recoverable errors with Ok/Err variants

Option

Handle nullable values safely with Some/None

? Operator

Propagate errors elegantly

Custom Error Types

Define domain-specific errors

Error Handling Simulator

📦 Collections Masterclass

Work with Vec, HashMap, HashSet, and iterators

Vec

Dynamic arrays with push, pop, iter

HashMap

Key-value store with O(1) lookup

HashSet

Unique values collection

Iterators

Lazy evaluation with map, filter, fold

Collection Operations

🎯 Pattern Matching Workshop

Exhaustive pattern matching with match, if let, while let

match Expression

Exhaustive pattern matching for all cases

if let

Concise pattern matching for single case

Destructuring

Break apart structs, enums, tuples

Match Guards

Add conditional logic to patterns

Pattern Matching Simulator

🔗 Smart Pointers Lab

Box, Rc, Arc, RefCell - memory management patterns

Box

Heap allocation for single ownership

Rc

Reference counting for shared ownership

Arc

Atomic Rc for thread-safe sharing

RefCell

Interior mutability pattern

Smart Pointer Usage

Memory Safety Rules

  • Box: Single ownership, heap allocation, no overhead
  • Rc: Multiple owners (single-threaded), reference counting
  • Arc: Thread-safe Rc, atomic reference counting
  • RefCell: Runtime borrow checking, interior mutability