Is it possible to make a rocket app inside of a rocket app? Where the inner app can get the dependencies provided by the outer app. Or vice versa where the outer app consumes the inner app?
You can make two crates using a cargo workspace and have one depend on the other.
I need the two projects to be nested, with one inside the other. With the inner project inheriting dependencies from the outer project. Is that possible?
For an example about use of workspaces mentioned by Alice, checkout the Cargo.toml of the rust-postgres crate.
It defines a workspace which includes the following crates as members:
"codegen", "postgres", "postgres-native-tls", "postgres-openssl", "postgres-protocol", "tokio-postgres",
And in turn, each of the crate has their own Cargo.toml defined inside their respective directories here.
Similarly you could define your workspace with as many member crates (Rocket apps in your case) as needed which can have a dependency hierarchy as desired.
When one crate imports another's in the same workspace, does the crate get the dependencies of the imported crate? And if I define a route (e.g.
/world) in the imported crate, can I do a
cargo run in the other crate and hit that endpoint? I have tried it, but it doesn't seem to be getting that endpoint
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.