Best organisation with multiple projects related?

Hi,

I create a project, then I create another load-testing-project.
The load-testing-project can be helpful for any project.
I have a directory for each project.

For now, I have to render this code all together.

I was thinking to have two directory with each one his Cargo.toml file but I wonder, if it is possible to do something like this where load-testing-project is related and expected to be used with this project :

**project**
----Cargo.toml
----src/
----src/main.rs
----test/
----**load-testing-project/**
---------Cargo.toml
---------src/main.rs

Cargo.toml files need very differents crate.

If the load-testing-project package contains only a binary crate, you could also have it as part of project; a single package can have multiple binaries. If you put load-testing-project/src/main.rs in project/src/bin/load-testing-project.rs, Cargo will be able to find it automatically.

Other than that, you can group multiple packages in a workspace, to make developing them togehter easier.

With the two way you explain, we will have only one Cargo.toml file with all the dependency of all the need in the two projects so ?

I think I will choose to separate them in this case.

If you put the load-testing-project binary into the project package then yes, you'd have to maintain the dependencies for both in the same Cargo.toml (there is one Cargo.toml per package—one package can contain multiple (binary) crates).

1 Like

Thank you, it is very clear.

Finally, I found it possible...

https://doc.rust-lang.org/cargo/reference/workspaces.html#the-workspace-section