This is very useful, especially in the workspace scenario.
Just like java maven: Maven – Introduction to the POM
For example:
# Cargo.toml
[workspace]
members = ["foo", "bar"]
[variables]
foo_name = "foo"
foo_version = "0.1.0"
# foo/Cargo.toml
[package]
name = "${foo_name}"
version = "${foo_version}"
# bar/Cargo.toml
[package]
name = "bar"
version = "0.1.0"
[dependencies]
${foo_name} = { version = "${foo_version}", path = "../${foo_name}" }
The variable foo_name
and foo_version
can be shared between packages. Therefore, it is very convenient to modify.