skyzh/type-exercise-in-rust
skyzh/type-exercise-in-rust has 1,519 GitHub stars and 68 forks. GitHot measured -1 in 7 days. Last checked 2026-11-10 03:18 UTC. Last push 2026-10-06.
Learn advanced Rust by building a type-safe, auto-vectorized database expression engine
实测星标增长
- 24小时
- 更新延迟
- 7天
- -1
- 15天
- 更新延迟
- 1个月
- 更新延迟
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
Build a Typed Database Expression Engine in Rust
A hand-written loop for one integer function is easy. A database expression engine also has to borrow strings without copying, preserve nulls, read several column representations, coerce types, and select functions at runtime.
This course builds the type families and checked boundaries that move those decisions out of each row loop. The result is a small auto-vectorized expression engine: authors write one scalar operation, while generic unary, binary, and ternary adapters reuse the checked batch path.
Read the course
The complete published course contains five modules and ten cumulative, independently testable checkpoints. Work through them in order; each extends the same starter and keeps the earlier supplied tests green. Plan roughly half a day for each checkpoint. An experienced Rust learner can finish in about five working days, while newer learners should expect to take longer.
What you will build
The five modules follow the engine from physical values to its outer async boundary:
- Type families and nullable views (Checkpoints 1–2): connect owned and borrowed scalars, arrays, builders, logical types, and checked Array, Constant, Indexed, and typed-null views.
- Shared evaluation and transactional strings (Checkpoints 3–4): lift scalar operations over batches and publish variable-width rows without exposing partial writes.
- Shape specialization and binary semantics (Checkpoints 5–6): specialize common column shapes while preserving fallback behavior, then separate total, fallible, and nullable-aware binary evaluation.
- Runtime erasure and the physical catalog (Checkpoints 7–8): erase whole typed expressions behind a checked batch boundary and build a discoverable catalog of concrete operations.
- Logical binding, one-level Lists, and batch async (Checkpoints 9–10): bind logical calls to physical expressions, add checked nullable List storage, and defer one complete batch in a borrowing future.
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.
Start the exercises
You should know ordinary Cargo use, enums, traits, references, and Option. Follow the
environment setup, then work only in
type-exercise-starter:
git fetch origin
git switch --create course-work --track origin/main
cargo check -p type-exercise-starter-expr --lib --locked
Choose another branch name if course-work already exists. The starter baseline should compile.
Do not inspect type-exercise/ or archived/ while solving an exercise.
How chapter tests work
Copy the cumulative supplied contract when you are ready to start a chapter:
cargo x copy-test --chapter 1
cargo test -p type-exercise-starter-supplied-tests chapter_1 --locked
The first focused run should fail because the new behavior is missing. 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. Never edit copied tests or supplied-tests/src/lib.rs; keep all earlier copied
chapters green.
Checkpoint 10 is the terminal unit. After completing it, cargo x copy-test --chapter 10 copies
the complete cumulative supplied contract.
Questions and feedback
Join skyzh's Discord server for discussion. For a concrete bug or improvement, open an issue or pull request.
License
The source code is licensed under Apache 2.0. See LICENSE. The mdBook text is © 2022-2026 Alex Chi Z and licensed under CC BY-NC-SA 4.0.
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,560 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,830 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,395 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,473 星标