I have a project that started from a small test but over time took over and now has grown quite a bit. I'd like to get some suggestions on how I should organize it in terms of crates/packages/workspaces/repositories... In particular, I'd like a solution that plays well with rust-analyzer.
The project has a total of 6 binaries and 11 libraries. The binaries target different architectures:
- 3 of them are compiled for
- 2 for
- 1 for
armv7r-none-eabi, that is
x86_64 binaries run on a controlling computer, while the
armv7r binaries run on a dedicated hardware that talks to the computer via network.
Each binary is in its own package , and the default target is specified in the package's .cargo/config file. The
aarch64 binaries have also special settings for custom linker and sysroot.
The libraries also have each their own package in the project root. Not all binaries use all libraries, but there is some overlap. Two of the libraries have
As of now, everything sits in the same git repository. This has the advantage that it's easy to keep the development of all binaries and libraries synchronized.
The major downside of my current approach, and the reason for this post, is that rust-analyzer is rather slow to start working properly (3–4 minutes). During this start-up time, I can see on the mode line  that rust-analyzer is looking at the same crates  over and over again. I suspect this has to do with the different targets and cargo features present in my packages.
I've once tried to create a workspace, but I didn't have much success. First, running
cargo from the workspace was ignoring the packages'
.cargo/config files, so I couldn't figure out how to have different targets for different packages in the workspace. Second, rust-analyzer was much faster to start, but was not really working: syntax checking and the like was not working on most of the files .
Do you have some suggestions on how to structure my project? If possible I'd really like to keep everything or most in the same repository to avoid the overhead of making sure all the repos are synchronized.
Thanks in advance!