LogoDuyệtSr. Data Engineer
HomeAboutPhotosInsightsCV

Footer

Logo

Resources

  • Rust Tiếng Việt
  • /archives
  • /series
  • /tags
  • Status

me@duyet.net

  • About
  • LinkedIn
  • Resume
  • Projects

© 2026 duyet.net | Sr. Data Engineer

Cargo: workspace inheritance

Since 1.64.0, Cargo now supports workspace inheritance, so you can avoid duplicating similar field values between crates while working within a workspace. Workspace inheritance can include things like shared version numbers, repository URLs, or rust-version.

This also helps keep these values in sync between crates when updating them. This makes it easier to handle large workspaces.

Cargo workspace inheritance

File: [ROOT]/Cargo.toml

[workspace]
members = ["a", "b"]

[workspace.package]
version = "1.2.3"

[workspace.dependencies]
serde = "1.0.145"
anyhow = "1.0.65"

File: [ROOT]/a/Cargo.toml

[package]
name = "a"

# use the package version from [ROOT]/Cargo.toml
version.workspace = true

[dependencies]
# use `serde` version from [ROOT]/Cargo.toml
serde = { workspace = true }
# use `anyhow` version from [ROOT]/Cargo.toml
anyhow.workspace = true

For more details, see workspace.package, workspace.dependencies, and "inheriting a dependency from a workspace".

References

  • Inheriting a dependency from a workspace - The Cargo Book
  • Cargo improvements: workspace inheritance and multi-target builds
Sep 24, 2022·3 years ago
|Rust|
RustCargo
|Edit|
On this page
  • References
On this page
  • References