Rs
Module 8Cargo & ModulesLesson 1 of 718 min

Cargo Project Layout

Folders, Cargo.toml, and lib vs bin.

Sketch

quant-lab/
  Cargo.toml
  src/main.rs
  src/lib.rs
  src/bs.rs
  src/mc.rs

Dependencies (local)

serde, rayon, ndarray, nalgebra, polars, chrono, rand, tokio, plotters, criterion

Playground

std only — we simulate module split with mod stats { ... }.

Challenge

Add stats::std_dev and annualize * sqrt(252).

Tips
  • pub for visibility
  • mod declares modules
  • Workspaces for multi-crate repos

Try it live

Cargo Project LayoutRust 2021
Loading editor…
Output
Press Run to compile and execute.