rust.quest_

// fn main() -> Result<Truth, Error>

compiling principles -> target/release/quest

four pillars, zero overhead

Hover or tap each pillar to flip and read the deeper rationale.

01

ownership

// pillar.01

flip ->

// fn ownership<T>(value: T)

Each value has a single owner. When the owner leaves scope, the value is dropped. No garbage collector. No reference counting overhead. Memory is freed by the compiler on a deterministic schedule that you can read in the source.

let s = String::from("hi");
let t = s; // s is moved
02

borrowing

// pillar.02

flip ->

// fn borrow<'a>(value: &'a T)

References are temporary, exclusive, and verified. You may have many readers, or one writer, but never both at the same instant. The borrow checker proves data races impossible before the binary exists.

fn read(s: &str) { /* … */ }
fn edit(s: &mut str) { /* … */ }
03

lifetimes

// pillar.03

flip ->

// fn longest<'a>(x: &'a str, y: &'a str)

Lifetimes are the visible scaffolding of memory truth. Every reference has an interval during which it is provably valid. The compiler reads those intervals and refuses to compile programs in which a reference could outlive its source.

struct Quote<'src> {
  text: &'src str,
}
04

traits

// pillar.04

flip ->

// impl Trait for Type

Traits describe capability, not hierarchy. A type opts into behavior by implementing the contract. Generic code resolves at compile-time: zero virtual dispatch, zero runtime cost, the abstraction collapses to direct calls.

trait Quest { fn step(&self); }
impl Quest for Adventurer { /* … */ }

the ecosystem, drawn in bauhaus

A network of crates: circles for safety, triangles for speed, squares for concurrency. Each line is a dependency edge.