Is that a way add some dependencies to workspace using `cargo add`?

⚓ Rust    📅 2025-10-26    👤 surdeus    👁️ 5      

surdeus

I want to add some dependencies to workspace.dependencies then add them to a certain package.I've been searching the internet but didn't find anything that could help.

Now I have to call cargo add xxx on a package, waiting cargo to generate the code, cutting the generated code and paste it to Cargo.toml file at workspace root, then add xxx.workspace = true back to the Cargo.toml file at that package. So I wonder if a command like cargo add xxx --workspace to add dependencies to workspace. Thanks.

3 posts - 2 participants

Read full topic

🏷️ Rust_feed