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

  • Arc<T> makes configuration, workspace data, strings, syntax trees, and query outputs cheap snapshot values.
  • Mutex/RwLock are confined to caches and VFS views that genuinely cross worker boundaries.
  • PathBuf exists in project/VFS layers; semantic base-db uses opaque FileId, preventing filesystem leakage.
  • Option<T> is fundamental because incomplete Rust syntax is ordinary IDE input.
  • Result<T, E> represents operational failure; parser APIs instead return a tree plus an error list.
  • Box<dyn FnOnce()> type-erases heterogeneous worker jobs.
  • atomics count extant tasks and make lightweight revision/lifecycle observations.
  • Command and child handles separate Cargo, rustfmt, flycheck, and proc macros from the analysis process.

The best lesson is negative capability: types make some dependencies impossible. The parser cannot query Salsa; semantic crates cannot discover paths; IDE return values do not leak syntax/HIR objects; only the binary crate serializes LSP.