Difference in usage between cargo workspace and vscode?

Hello,

I was reading the cargo workspace feature.

Currently, I have my crates that I import in a workspace in vs code (add folder to workspace). It looks like I have everything I need, and modifications are checked immediately.
In my differing crates, I put some tests, so I need to generate some form of binaries for each of them.

Apparently, cargo workspace enable to have a single lock file. But this aside, what does it bring me in comparison to importing in a workspace in VSC?

Thank you

You are comparing apples to oranges. Workspace in your text editor and in build system are two completely different concepts. If you don't understand what is the point of cargo workspaces, please read relevant chapter in The Rust Book and from Cargo Reference.

1 Like

I already read that,
I am asking about the practical day to day differences. What does it solves vs the workspaces in cargo.

Sorry if I misunderstood, BTW.

A cargo "workspace" is a build system concept it has no relationship with the VScode "workspace" even though they use the same word.


I'd expect a VScode workspace to show all of the crates of a cargo workspace, and that's generally very easy since the cargo.toml defining its workspace should be at the root of the project.

1 Like

Thank you.
Does it enable further compilation time savings? Because like I said, I have tests in different crates, so it is compiled anyway.

Since I have my crates versions set up in the main cargo.toml, I fail to see the benefits for me.
Even modifying a "sub crate" will trigger a recompilation on my main crate.

To me, with my current state of understanding, it is just more work to set a master cargo.toml for no reason.

That's where I am in my reasoning.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.