type-exercise-in-rust: the answers sit in a neighbouring directory
Learn advanced Rust techniques by building an expression evaluation framework for a database system.
At a glance
- What is it?
- A course that builds a typed, auto-vectorized expression engine for a database in Rust, one checkpoint at a time, with a copied-in test contract per chapter. The finished expression crate lives in the same repository as the starter you are told to work in, one directory over, next to an archived copy of two older layouts.
- Who is it for?
- The course suits someone who can already write ordinary Rust and wants to see generics used for something structural rather than decorative, since every module moves a decision out of the row loop and into a type or a checked boundary. Two things to know before you start.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 39 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.
Star history
- skyzh/type-exercise-in-rust1,519 ★ · +36
| Repository | 2026-08-02 | 2026-11-13 |
|---|---|---|
| skyzh/type-exercise-in-rust | 1.5k | 1.5k |
36 Stars in the last 103 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The finished crate is in the same branch as the exercises
The top-level listing contains both halves of the course side by side. There is type-exercise-starter/, the directory the instructions tell you to work in, and type-exercise/, which the workspace manifest lists first among its members and which the file tells you not to inspect while you are solving an exercise. There is also an archived/ directory, which the manifest excludes from the workspace by naming archived/type-exercise-ref and archived/legacy-days/*, meaning two previous layouts of the same material are kept in the repository but outside the build. So the reference implementation of every checkpoint is available to anyone who opens the repository, one directory to the left of the work area. That is a deliberate choice for an open course rather than a leak, and it means the exercises test whether you can resist a shortcut, not whether the answer is hidden.
Ten checkpoints, half a day each
The published course is five modules and ten cumulative, independently testable checkpoints, and the file gives both a schedule and a rule. Work through them in order, because each one extends the same starter and keeps the earlier supplied tests green, which means a later checkpoint that fails may have broken something from an earlier one. The time estimate is explicit: plan roughly half a day for each checkpoint, an experienced Rust learner can finish in about five working days, and newer learners should expect to take longer. Independently testable is doing real work in that phrase, since each chapter brings its own contract rather than one test at the end. The prerequisites are correspondingly narrow: ordinary Cargo use, enums, traits, references and Option, and nothing else is assumed.
The list of things the course refuses to build
One paragraph does more work than any feature list in most course repositories, and it is the exclusion list. The course deliberately stops short of Decimal arithmetic, casts and rounding, lossy coercions, nested or list-producing functions, exhaustive fast paths, an aggregate engine, and per-row futures. Each exclusion is a design decision with a cost attached. No Decimal means the numeric story stays exact rather than approximate; no casts and no lossy coercions means type errors surface at the boundary instead of silently changing values; no exhaustive fast paths means specialization is opportunistic and there is always a fallback; no aggregate engine means nothing groups rows; no per-row futures means the async boundary defers a whole batch rather than a row, which is the single most consequential omission in the list. Read the exclusions as the specification of what a columnar engine stops being.
cargo x copies the test contract in before you write anything
The chapter workflow is two commands, and the order matters:
git fetch origin
git switch --create course-work --track origin/main
cargo check -p type-exercise-starter-expr --lib --lockedThat establishes a working branch and confirms the starter baseline compiles, and the file notes you should pick a different branch name if course-work already exists. Then, per chapter:
cargo x copy-test --chapter 1
cargo test -p type-exercise-starter-supplied-tests chapter_1 --lockedThe first focused run is expected to fail, because the behaviour does not exist yet. You read the copied destination under type-exercise-starter/supplied-tests/src/, implement the named API in other starter files, and rerun the same command until it passes. Two prohibitions and one convention: never edit the copied tests or supplied-tests/src/lib.rs, keep every earlier copied chapter green, and treat checkpoint 10 as terminal, since copying chapter 10 brings the complete cumulative contract in one go.
Resolver 3, twenty checkpoint crates, and two version schemes
The workspace manifest is where the course's shape becomes concrete. It uses resolver 3, edition 2024, and lists its members as the expression crate and supplied tests for both the finished exercise set and the starter, plus xtask, plus a glob over checkpoint/chapter-*/expr and checkpoint/chapter-*/supplied-tests. Those globs mean every chapter has its own pair of crates, one per checkpoint per side, while default-members lists only the first five paths, so a plain cargo command at the root does not build the checkpoints. Two archived paths are excluded outright. The package metadata says version 0.2.0-alpha.1 and publish = false, which is right for something nobody installs from a registry, and the single release is tagged v202609, a date rather than a version. So there are two versioning schemes in one repository and neither is a stable release you can depend on.
Two licences, and the restrictive one covers the prose
The licence section splits the repository in two. The source code is under Apache 2.0, with the LICENSE file at the root. The mdBook text is a separate work, copyright 2022 to 2026 Alex Chi Z, licensed under CC BY-NC-SA 4.0. The non-commercial and share-alike conditions of that second licence apply to the written material, not to the code, and they are the part that matters if you are a company considering this as training: attribution, non-commercial use and share-alike for the book, while the code you write in the starter directory is yours under Apache 2.0. A repository that mixes a permissive code licence with a non-commercial documentation licence is common in course projects and is worth reading twice before you reuse either half.
From physical values to a borrowing future
The five modules trace one path through the engine, and each names the checkpoints it covers. Type families and nullable views, checkpoints 1 and 2, connect owned and borrowed scalars, arrays, builders and logical types, and produce checked Array, Constant, Indexed and typed-null views. Shared evaluation and transactional strings, checkpoints 3 and 4, lift scalar operations over batches and publish variable-width rows without exposing partial writes. Shape specialization and binary semantics, checkpoints 5 and 6, specialize the common column shapes while preserving fallback behaviour and separate total from fallible from nullable-aware binary evaluation. Runtime erasure and the physical catalog, checkpoints 7 and 8, erase whole typed expressions behind a checked batch boundary and build a catalog of concrete operations that can be discovered. The last module, checkpoints 9 and 10, binds logical calls to physical expressions, adds checked nullable List storage at one level, and defers a complete batch in a borrowing future.
Editorial conclusion
The course suits someone who can already write ordinary Rust and wants to see generics used for something structural rather than decorative, since every module moves a decision out of the row loop and into a type or a checked boundary. Two things to know before you start. The reference implementation sits in the same branch as the exercises, so the only thing between you and the answer is a directory name and an instruction, and a self-paced learner will have to supply their own discipline there. And the licence is split: the code is Apache 2.0 while the book text is CC BY-NC-SA 4.0, so the prose is not free for commercial use even though the code is. Version identity is loose as well, with an alpha workspace version and a date-based release tag. Last commit on main 2026-09-23.
Frequently asked questions
What does the type-exercise-in-rust course build?
A small auto-vectorized expression engine for a database. Authors write a single scalar operation, while generic unary, binary and ternary adapters reuse the same checked batch path, so the decisions about nulls, string borrowing, column representations and type coercion sit in types and boundaries instead of in each row loop.
How long does type-exercise-in-rust take to finish?
The published course has five modules and ten cumulative, independently testable checkpoints. The file suggests roughly half a day per checkpoint, says an experienced Rust learner can finish in about five working days, and says newer learners should expect to take longer. Each checkpoint extends the same starter and keeps the earlier supplied tests green.
What do I need to know before starting type-exercise-in-rust?
Ordinary Cargo use, enums, traits, references and Option, plus the environment setup page the file links. You then create a working branch tracking main, confirm the starter compiles with cargo check on the starter expression crate, and do all your work in type-exercise-starter.
How do the chapter tests work in type-exercise-in-rust?
Run cargo x copy-test with the chapter number to copy the cumulative supplied contract into the starter, then run cargo test against the supplied tests package for that chapter. The first focused run is expected to fail until you implement the named API in other starter files. Copied tests and supplied-tests/src/lib.rs must not be edited, and earlier copied chapters have to stay green.
What license applies to type-exercise-in-rust?
Two of them. The source code is Apache 2.0, with the LICENSE file at the root. The mdBook text is copyright 2022 to 2026 Alex Chi Z and licensed under CC BY-NC-SA 4.0, so the written material carries attribution, non-commercial and share-alike conditions while the code does not.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/skyzh-type-exercise-in-rust)Star history chart for your README
[](https://hysenlabs.com/projects/skyzh-type-exercise-in-rust)Was this useful?