← Back to Home
All Patterns
Browse and filter 41 advanced Rust patterns
Filters
Difficulty
All (41)
Intermediate (14)
Advanced (18)
Expert (9)
Tags
All Tags
advanced
alignment
anyhow
api-design
arc
associated-types
async
async-iterator
atomic
attribute
backpressure
benchmark
blanket
borrowing
builder
c-interop
cancellation
cell
channel
cleanup
Features
🎮 Has Playground (41)
⚡ Has WASM Demo (2)
Showing
41
of 41 patterns
Split Borrowing
advanced
Borrow different parts of a struct simultaneously
🔐
Ownership & Borrowing Patterns
borrowing
mutability
structs
🎮 Playground
Interior Mutability Patterns
advanced
When to use Cell, RefCell, and Mutex
🔐
Ownership & Borrowing Patterns
cell
refcell
mutex
🎮 Playground
Self-Referential Structures
expert
Using Pin and safe patterns for self-references
🔐
Ownership & Borrowing Patterns
pin
unsafe
advanced
🎮 Playground
Lifetime Elision Mastery
advanced
Complex lifetime scenarios and elision rules
🔐
Ownership & Borrowing Patterns
lifetimes
references
🎮 Playground
RAII Guards
intermediate
Custom drop guards for resource management
🔐
Ownership & Borrowing Patterns
drop
resources
raii
🎮 Playground
Rc/Arc Usage Patterns
intermediate
When to use each and cycle prevention
🎯
Smart Pointers & Interior Mutability
rc
arc
reference-counting
🎮 Playground
⚡ WASM
Weak Pointers
advanced
Breaking cycles in graph structures
🎯
Smart Pointers & Interior Mutability
weak
graphs
cycles
🎮 Playground
Clone-on-Write (Cow)
intermediate
Zero-copy until mutation needed
🎯
Smart Pointers & Interior Mutability
cow
optimization
cloning
🎮 Playground
Custom Smart Pointers
expert
Building your own Box-like types
🎯
Smart Pointers & Interior Mutability
deref
drop
custom
🎮 Playground
Custom Error Types
intermediate
Implementing std::error::Error properly
⚠️
Error Handling Excellence
error
custom-types
🎮 Playground
Error Composition
intermediate
Using thiserror and anyhow effectively
⚠️
Error Handling Excellence
thiserror
anyhow
composition
🎮 Playground
Result Combinators
intermediate
and_then, or_else, map_err mastery
⚠️
Error Handling Excellence
result
combinators
functional
🎮 Playground
Error Context
advanced
Maintaining error chains and context
⚠️
Error Handling Excellence
context
error-chains
🎮 Playground
Associated Types vs Generics
advanced
When to use which approach
🎨
Advanced Trait System
traits
associated-types
generics
🎮 Playground
Higher-Ranked Trait Bounds
expert
for<'a> patterns and HRTBs
🎨
Advanced Trait System
hrtb
lifetimes
advanced
🎮 Playground
Trait Objects & Dynamic Dispatch
intermediate
Box<dyn Trait> patterns and vtables
🎨
Advanced Trait System
dyn
dynamic-dispatch
vtable
🎮 Playground
Blanket Implementations
advanced
Implementing traits for generic types
🎨
Advanced Trait System
blanket
impl
generics
🎮 Playground
Orphan Rules & Newtype
intermediate
Working with external traits
🎨
Advanced Trait System
orphan-rules
newtype
wrapper
🎮 Playground
Custom Future Implementation
expert
Building futures from scratch
⚡
Async/Await & Futures
future
async
poll
🎮 Playground
Stream Processing
advanced
Async iterators and backpressure
⚡
Async/Await & Futures
stream
async-iterator
backpressure
🎮 Playground
Select/Join Patterns
intermediate
Concurrent future composition
⚡
Async/Await & Futures
select
join
tokio
🎮 Playground
Cancellation & Timeouts
advanced
Proper cleanup patterns
⚡
Async/Await & Futures
cancellation
timeout
cleanup
🎮 Playground
Declarative Macros
intermediate
macro_rules! patterns and repetition
🔮
Macro Mastery
macro_rules
declarative
🎮 Playground
Procedural Macros
expert
Derive, attribute, and function-like
🔮
Macro Mastery
proc-macro
derive
attribute
🎮 Playground
DSL Creation
expert
Domain-specific languages in Rust
🔮
Macro Mastery
dsl
macro
syntax
🎮 Playground
Iterator Composition
intermediate
How iterators optimize to machine code
🚀
Zero-Cost Abstractions
iterator
optimization
zero-cost
🎮 Playground
Monomorphization
advanced
Understanding generic compilation
🚀
Zero-Cost Abstractions
generics
compilation
optimization
🎮 Playground
Const Evaluation
advanced
Compile-time computation
🚀
Zero-Cost Abstractions
const
compile-time
const-fn
🎮 Playground
State Machines in Types
advanced
Compile-time state validation
🎭
Type-State Programming
typestate
state-machine
types
🎮 Playground
⚡ WASM
Builder with TypeState
advanced
Enforcing build order at compile time
🎭
Type-State Programming
builder
typestate
api-design
🎮 Playground
Phantom Types
advanced
Zero-runtime-cost type information
🎭
Type-State Programming
phantom
zero-cost
marker
🎮 Playground
Send/Sync Bounds
intermediate
Understanding thread safety
🔀
Concurrency Patterns
send
sync
thread-safety
🎮 Playground
Channel Patterns
intermediate
mpsc, oneshot, broadcast patterns
🔀
Concurrency Patterns
channel
mpsc
communication
🎮 Playground
Lock-Free Data Structures
expert
Using atomics correctly
🔀
Concurrency Patterns
atomic
lock-free
concurrent
🎮 Playground
Scoped Threads
advanced
Borrowing across thread boundaries
🔀
Concurrency Patterns
scope
threads
borrowing
🎮 Playground
Safe Abstractions Over Unsafe
expert
Encapsulation patterns for unsafe code
⚡
Unsafe & FFI
unsafe
encapsulation
safety
🎮 Playground
FFI Boundaries
advanced
C interop best practices
⚡
Unsafe & FFI
ffi
c-interop
extern
🎮 Playground
Memory Layout
advanced
#[repr(C)] and layout guarantees
⚡
Unsafe & FFI
repr
layout
memory
🎮 Playground
Memory Layout Optimization
advanced
Struct packing and alignment
⚡
Performance Optimization
memory
alignment
optimization
🎮 Playground
SIMD Patterns
expert
Portable SIMD and platform-specific
⚡
Performance Optimization
simd
vectorization
performance
🎮 Playground
Benchmarking with Criterion
intermediate
Proper performance measurement
⚡
Performance Optimization
benchmark
criterion
performance
🎮 Playground