rust-impl-workspaces
rust-impl-workspaces
A Cargo workspace is one or more packages (the members) that share a single Cargo.lock, a single target/ directory, and a single root manifest. For any project larger than one crate (binary + reusable library, a CLI plus its core, a monorepo of microservices, a plugin host plus plugins), workspaces are the only correct organisational unit. Without them you get duplicate target/ directories, drifting dependency versions, duplicated metadata, and lockfile divergence across crates.
Cross-references: [[rust-impl-cargo-project]] (single-crate Cargo.toml basics, profiles, features), [[rust-core-language-versions]] (resolver 3 ships with Rust 1.84; edition 2024 defaults to it), [[rust-core-toolchain]] (rust-toolchain.toml and rustup channels for the whole workspace).
When to use this skill
- The user has, or is about to have, more than one crate in the same repository.
- A binary depends on a library that lives in the same repo.
- The user asks "how do I share
serde = "1"across all my crates without copy-pasting the version". - The user wants to set
edition = "2024"once and not in every member. - The user is choosing between
resolver = "2"andresolver = "3". - The user hits "two different versions of
serdein one build" (lockfile drift between standalone Cargo projects in the same repo, fixed by promoting them to a workspace). - The user sees
target/appearing in three different crate directories.