Throw if a condition is false, with TypeScript narrowing the type afterwards. Replaces ad-hoc `if (!x) throw` ladders and gives you type-safe guards in one line.
Tests live alongside the code they test. `cargo test` runs every `#[test]` function. Use `#[cfg(test)] mod tests` so the test code is compiled out of release builds.