| Crates.io | cargo-dependency-inheritor |
| lib.rs | cargo-dependency-inheritor |
| version | 0.1.1 |
| created_at | 2022-09-20 20:59:05.432332+00 |
| updated_at | 2022-09-23 17:14:08.655279+00 |
| description | Utility that inherits dependencies from the main workspace if they occur 'n' or more times in the workspace. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 670131 |
| size | 25,702 |
Utility that inherits dependencies from the main workspace if they occur n or more times in the workspace.
Workspace Inheritance was stabilized in version 1.64.
See [workspace.package], [workspace.dependencies], and inheriting-a-dependency-from-a-workspace for more information.
To inherit a dependency that occurs five or more times in the workspace, use the following command:
cargo install cargo-dependency-inheritor
cargo dependency-inheritor --workspace-path "path/to/workspace/Cargo.toml" -n 5
This command edits your toml files, make sure to have a back up
Dependencies can be inherited from a workspace by specifying the dependency in the workspace's [workspace.dependencies] table. After that, add it to the [dependencies] table with workspace = true.
This crate automates the process.
[workspace] section of the workspace-file.n or more times.n or more times:
dependency = "0.1.3" into inline tables.workspace = true key-value to the dependency inline table.version from inline table if exists (this will be specified in the workspace file).[workspace.dependencies] table to root workspace file with all the dependencies that occurred n times and their version.Result:
# in a project
[dependencies]
tokio = { workspace = true }
# in the workspace
[workspace.dependencies]
tokio = "1.0"