Go from noob to systems-level pro by stepping through Stack frames, Heap pointers, Lifetimes, VTables, Tokio Wakers, and UniFFI bridges—mapped directly to your Kotlin & Android instincts.
| Concept | Kotlin / Android | Rust Equivalent | Key Mental Shift |
|---|---|---|---|
| Immutability | val vs var |
let vs let mut |
Rust mutability also governs internal field & buffer mutation. |
| Null Safety | String?, ?., ?: |
Option<T>, match, .unwrap_or() |
No null in Rust; Option<Box<T>> has 0B overhead (NPO). |
| State Modeling | sealed class + when |
enum (with data) + match |
Contiguous Stack Tagged Union instead of Heap subclasses. |
| Interfaces | interface (JVM Erasure) |
trait (impl vs dyn) |
Static monomorphization by default; opt into VTables via dyn. |
| Memory | JVM Garbage Collector | Ownership, Borrowing & Lifetimes | Deterministic Drop at closing brace }; zero GC pauses. |
| Collections | List / asSequence() |
Vec<T> / Lazy Iterator |
Iterators are lazy by default and LLVM-fused into 1 tight loop. |
| Async / Threads | Coroutines & Dispatchers |
async/.await + Tokio |
Pull-based Stack state machines; cancellation = synchronous Drop. |
| Native Interop | Manual JNI / C++ NDK | Mozilla UniFFI + cargo-ndk |
Auto-generates type-safe Kotlin bindings, Exceptions & suspend fun. |