ArdanUltimateRust-5Days icon indicating copy to clipboard operation
ArdanUltimateRust-5Days copied to clipboard

Using workspace

Open rustkas opened this issue 1 year ago • 2 comments

I was a little bit confused about working with workspace because VS Code functionality of Rust tools generate a little bit different syntax of workspace description. They bring workspace information on top of Cargo.toml file like that:

workspace = { members = [ "session1/hello_world", "session1/variables"] }
[package]
name = "live_at_ardan"
version = "0.1.0"
edition = "2021"

rustkas avatar Apr 20 '24 02:04 rustkas

https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html

Cargo.toml when is being used for a workspace doesn´t need to include [package] info.

Just need to define that is a workspace, and the members of that workspaces, where you can use *, if you dont want to list every file manually

probably you already figured out, but just pointing it out, hope it helps

yoshijulas avatar Oct 15 '24 18:10 yoshijulas

The workspace syntax keeps updating; the next version will use the newer [workspace.dependencies] setup at the top of the workspace and then you can do things like tokio = { workspace = true } (or tokio.workspace = true) to get better library reuse. The semantics of that have improved quite a bit in the last year.

thebracket avatar Nov 09 '24 16:11 thebracket