I am working with a CLI application suite built in Rust. I currently configured Rust-Analyzer to help manage the project but I am getting errors across my suit on the crate imports of my sub applications.The rand, rusqlite, and regex crates are not being found by the analyzer depsite being declared at the workspace root in the main Cargo.toml and in the Sub applications local Cargo.toml
Currently my app structure looks like:
rust-cli-buddy/
├── Cargo.toml (Main Cargo.toml for the entire application suite)
│── buddy_manager/ (Main application manager)
│ └── src/
│ └── main.rs
│
│── app1/ (Subfolder for application 1)
│ └── src/...
│
│── app2/ (Subfolder for application 2)
│
│ └── src/...
│
│── ... (Other subfolders for additional applications)
└── ...
The manager is run by default using the root Cargo.toml:
[package]
name = "rust-cli-buddy"
version = "0.1.0"
edition = "2021"
authors = ["Jesse jesse.greenough84@gmail.com"]
license = "MIT"
default-run = "buddy-manager"
[workspace]
members = [
"buddy-manager",
"calculator",
"password-manager",
"password-generator",
"file-organizer",
"task-manager",
"development-timer",
"word-analyzer",
]
[dependencies]
buddy-utils = { path = "./buddy-utils" }
... other crates used in the app
[[bin]]
name = "buddy-manager"
path = "buddy-manager/src/main.rs"
... other sub app libraries and binaries
Each sub app has their own Cargo.toml declaring the package of the format:
[package]
name = "<app_name>"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
buddy-utils = { path = "../buddy-utils" }
... crates used in current sub-app
[[bin]]
name = "<app_name>"
path = "src/main.rs"
I am new to Rust package management and wonder if I have anything wrong as of now? Everything is able to run but is there better practices for this?
I have looked at all the different ways to reference the dependency, looked down the entirety of Rust-Analyzers settings, and have tried to personally debug with the analyzers output.
I can't seem to find why the Analyzer is not finding the crates despite them being declared and working as expecting in the actual building and running of the application?