Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Standard Library as Architecture

  • Path and PathBuf distinguish borrowed locations from owned paths moved into workers.
  • Arc<T> shares immutable distributions, caches, reporters, and semaphore budgets.
  • HashMap/HashSet encode package indexes, installed state, and plan membership.
  • BTreeMap supplies deterministic serialization where reproducible lock output matters.
  • NonZeroUsize and available_parallelism() connect configuration to a valid machine-derived default.
  • Cow<'a, T> avoids cloning unchanged requirements while still allowing marker-adjusted owned variants.
  • filesystem handles and RAII lock guards make process-level ownership end on drop.
  • Command, ExitStatus, and pipes model Python/build tools as fallible external actors.

Most performance comes from choosing which values are immutable and reusable. An Arc<Dist> can cross many futures; the mutable environment cannot. A PathBuf moved into spawn_blocking is simple proof that the task does not retain a borrowed command context.