snapfitThe Snapfit Book (v0.1.0)

Edition v0.1.0

Contents

The Snapfit Book for Rust (v0.1.0), in reading order. It follows the plan in BOOK.md and the directive layout in FORMAT.md. Every program the chapters show is complete: those in examples run with cargo run -p snapfit_book --example <name> from the repository root.

Welcome

Part 1: Why dependency injection

  1. A service that builds its own dependencies
  2. Choosing between implementations
  3. Who builds everything?

Part 2: Snapfit

  1. Why we built Snapfit

Part 3: Wiring a container

  1. Installing Snapfit and your first singleton
  2. Pure domain types, one container
  3. Wiring dependencies and custom constructors
  4. Read the container, know the graph
  5. Multiple instances of the same type
  6. Passing dependencies by name
  7. Choosing an implementation

Part 4: Compile-time guarantees and agents

  1. Mistakes caught by the compiler
  2. Working with coding agents

Appendices