Cargo Workspaces
Workspaces let you manage multiple crates in a single repository. They share a
common Cargo.lock and output directory, which makes builds faster and
dependencies consistent.
Defining a Workspace
Create a top-level Cargo.toml:
[workspace]
members = [
"cli",
"core",
"utils",
]
Each member is a normal Cargo crate in its own directory.
Why Use Workspaces?
- Share code between crates without publishing
- Keep one
Cargo.lockfor consistent dependency versions - Build and test all crates together with
cargo buildorcargo test
Workspaces are ideal for larger Oxide projects, especially when you want to split libraries and binaries into separate crates.