Governing Rust by Contract: Owning the Bits, From the Compiler to the Cluster
Software
A free guide to governing a Rust adoption: what the compiler proves, what tooling must enforce, and what operations and people still own, with contract cards and templates.
TL;DR: A compiler can refuse whole classes of mistakes, and it is easy to oversell what that refusal covers. Governing Rust by Contract is a free guide for the people who approve a Rust adoption. It sorts every guarantee into three tiers (compiler, tooling, operations and people) and writes each one as a contract with an owner and evidence. Read it online, download the PDF, or take the Practitioner kit.
A language decision outlives the argument that produced it, and the costs it creates stay long after the people who argued for it move on. The part that outlives the debate is the decision itself: who owns it, what it must deliver, and how the estate proves, year after year, that it still holds. In this book Rust is the case study. Governance is the subject.
I call the goal owning the bits. A team owns the bits when it can answer, with evidence, five questions about any service it runs: where memory lives and who frees it, what the binary contains, what each dependency brought in and who approved it, how the service behaves at the 99th percentile on a bad day, and who owns each of those answers. Any language can answer them with enough effort. Rust makes some answers cheaper because the compiler checks them. The fifth question is never answered by a language. It is answered by an operating model.
Why the book exists: three tiers, one picture
A compiler proves some things. It does not prove that your dependencies are honest, that your service drains cleanly when a node is retired, or that the business logic is right. So the book is built on one honest picture of where each guarantee comes from.
- The compiler proves, inside the trusted boundary. Memory safety and freedom from data races in safe Rust, plus types, ownership and exhaustive matching. Those proofs are conditional: they rely on a correct compiler and on sound unsafe code underneath, in the standard library, in dependencies, at FFI boundaries and in the allocator. What enters the build (the lockfile, build scripts, procedural macros) is a separate supply-chain question that tooling has to govern.
- Tooling enforces, at CI gates, in policy and through signing. Dependency and license policy, advisories, API semver, performance budgets and provenance.
- Operations and people own the run and the decision. Operating system, allocator and scheduler behavior, the cluster, deadlocks, logic, business correctness, and the decision itself.
Every chapter asks which tier holds a guarantee. Compiler enforcement is usually earlier and more consistent than review or runtime controls. Moving a guarantee toward the compiler, from people to tooling or from tooling to the compiler, is most of what good engineering governance does.
The book is also careful with the public evidence. The well-known memory-safety figures (Microsoft MSRC, 2019; Chromium; Android, 2024) come from C and C++ codebases. They are evidence for reducing exposure to memory-unsafe code, for example by writing new code in a memory-safe language next to existing C and C++. They are not evidence for rewriting a Java, .NET, Go or TypeScript service in Rust. Against managed runtimes the case is narrower: predictability, footprint and control, with real costs in build time, skills and ecosystem maturity.
What is in the book
- Part I, The Decision. What Rust changes and what it does not, a decision record written so it can be renewed or reversed, and a whole chapter on when not to use Rust.
- Part II, The Code Door. The compiler contract, the exception contract for unsafe code, FFI and build-time code, and the verification contract.
- Part III, The Supply-Chain Door. Pinning dependencies and the toolchain, the admission gate for what may enter a build, and the promise a public interface makes.
- Part IV, The Runtime Door. Shipping the artifact and running it under contract, including how to measure latency instead of quoting it.
- Part V, Run the Decision. The operating model that keeps the decision owned after the people who made it move on.
- Appendices. Templates and a small reference service measured with a method you can rerun, the three tiers mapped onto TypeScript, Go, .NET and Java, and a glossary with a source register.

Chapters 4 to 11 each end with a contract card: the contract, the threat it addresses, its owner, where it is enforced, how it fails, who may waive it and until when, and the evidence that it ran. Every chapter from 1 to 12 ends with a short checklist. There are no cross-language speed contests. Tools appear where they are the standard way to do something, and configuration files carry the toolchain version they were checked against.
Who it is for
The reader I have in mind is a CTO, a CIO, an enterprise or platform architect, an engineering lead or a CISO. You are accountable for a language decision, or you will be asked to approve one. You may not write Rust yourself. You need to know what it buys, what it costs, how to govern it once it is in the estate, and when to say no.
Every chapter opens with its point in plain words, so a CTO can read the lead and stop. The CTO path is the preface and chapters 1, 2, 3, 8, 11 and 12. Architects who will build the gates can read Parts II to IV in full. It is not a Rust tutorial, and it is not a claim that Rust should replace everything.
How it was made and checked
I wrote the plan, the structure and the positions. The chapters were drafted with AI writing agents working from that plan. The text was then fact-checked and revised over several review rounds, with multiple AI models prompted to read it as an architect, a security reviewer and a technical editor. Every factual finding they raised was checked against official documentation and the primary source behind each cited figure before a change was accepted. Findings that did not hold up were rejected.
To be plain about it: the reviews were AI-assisted, not an independent audit.
Read it, download it, use it
- Read free online: blog.jcardena.com/en/ebooks/governing-rust-by-contract
- Download the PDF: Governing Rust by Contract (PDF)
- Practitioner kit, free: editable templates, contract cards and the master checklist
Kindle Practitioner Edition: the same book with an added Practitioner pack (a worked 90-day case, every contract card in one place, a master checklist and review-board questions) is on Amazon Kindle.
A useful first question for any team that wants Rust: for each guarantee you expect from it, which tier enforces it, who owns it, and what evidence shows it ran and passed last month? The language was the occasion. The principle is what still holds: a guarantee is only as real as its enforcer: every line holds only as far as the tier that enforces it.