Learn Rust, from zero to production.
Learn Rust from scratch by building a real computation engine
A progressive, bilingual course: every notion explained simply, exercises with solutions, and a running project that grows with you into a Monte Carlo risk engine callable from Kotlin.
- modules
- 14
- lessons available
- 32
- project steps
- 11
fn expected_exposure(mtms: &[f64]) -> f64 { let total: f64 = mtms.iter().map(|m| m.max(0.0)).sum(); total / mtms.len() as f64} fn main() { let mtms = vec![1_200.0, -300.0, 450.0, 0.0, -800.0]; println!("EE = {:.2}", expected_exposure(&mtms)); // 330.00}Running project
riskforge, step by step
Throughout the course you build riskforge: a Monte Carlo engine that simulates the exposure of a derivatives portfolio to a counterparty (EE, PFE, EPE, then CVA). Each module ends with a step of the project, so by the end you have a real Rust program, parallelized, benchmarked, and callable from Kotlin.
Workbook on GitHub ↗- 01
Kick off the project
A Cargo crate that compiles and prints the simulation context.
- 02
Positive exposure
Exposure of one scenario and the average over a few hard-coded scenarios.
- 03
Aggregate without copying
Functions that borrow scenarios (&[f64]) instead of duplicating them.
- 04
Domain model
Trade, NettingSet and instrument types modeled with structs and enums.
- 05
Portfolio
Trades filed by counterparty in a HashMap of netting sets, sorted report.
- 06
Load a portfolio
Reading a CSV of trades with typed errors, without a single panic.
- 07
Diffusion models
A shared trait for GBM and mean reversion (Ornstein-Uhlenbeck), and a first Monte Carlo simulation.
- 08Coming soon
Exposure profiles
EE, 97.5% PFE and EPE computed with iterators across the whole time grid.
- 09Coming soon
Tests and benchmarks
Unit tests, comparison with the Kotlin results and criterion benchmarks.
- 10Coming soon
Parallelization
Simulation spread across every core with rayon, speedup measured.
- 11Coming soon
Called from Kotlin
C-ABI library called from the JVM (FFM API), final JVM versus Rust benchmark.
Your progress
0/32You haven't started yet. Jump into the first lesson!
Course modules
Getting started
Understand what Rust is, install the toolchain, and run your first Cargo project.
Language basics
Variables, types, functions and control flow: the core grammar of Rust.
Ownership and borrowing
The concept that makes Rust unique: who owns a value, who may read it, who may change it.
Structs, enums and pattern matching
Model a domain with precise types, and let match check every case.
Collections
Vec, String and HashMap: the everyday data structures.
Error handling
Option, Result and the ? operator: errors visible in the types, no exceptions.
Traits and generics
Polymorphism the Rust way: shared behavior, with zero runtime cost.
Closures and iterators
map, filter, fold: functional code as fast as a hand-written loop.
Lifetimes
Understand 'a annotations and why the compiler sometimes needs them.
Modules, tests and benchmarks
Organize a crate, write built-in tests and measure with criterion.
Smart pointers
Box, Rc, Arc and RefCell: when single ownership is not enough.
Concurrency
Threads, channels and rayon: parallelism without data races, guaranteed by the compiler.
Async with Tokio
async/await, futures and the Tokio runtime for network programs.
FFI and JVM interop
Controlled unsafe, the C ABI, and calling a Rust library from Kotlin.